home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / svgapb23 / svgapb23.txt < prev    next >
Encoding:
Text File  |  1995-01-19  |  274.6 KB  |  11,802 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                   REFERENCE MANUAL
  9.  
  10.  
  11.                                    FOR SVGAPB.LIB
  12.  
  13.  
  14.                                     THE SUPER VGA
  15.  
  16.  
  17.                                   GRAPHICS LIBRARY
  18.  
  19.  
  20.                                    TO BE USED WITH
  21.  
  22.  
  23.                                      POWER BASIC
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.           1993-1995 by Zephyr Software - Stephen L. Balkum and Daniel A.
  45.           Sill
  46.  
  47.           All rights reserved.  No part of this book shall be reproduced or
  48.           transmitted by any means, electronic, mechanical, photocopying,
  49.           recording or otherwise, without written permission from Zephyr
  50.           Software - Stephen L. Balkum and Daniel A. Sill.
  51.  
  52.           Although every effort has been made to insure the accuracy of the
  53.           material in this book, Zephyr Software, Stephen L. Balkum and
  54.           Daniel A. Sill assume no responsibility for errors or omissions.
  55.           In addition no liability is assumed for damages resulting from
  56.           the use of the information contained herein.
  57.  
  58.           Printed in the United States of America
  59.  
  60.           Trademarks
  61.  
  62.       Sound Blaster and Sound Blaster Pro are trademarks of Creative
  63.           Labs, Inc.
  64.           All others are trademarks of their respective owners.
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.                                                                          ii
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                              SOFTWARE LICENSE AGREEMENT
  92.  
  93.                By using this software, you agree to the terms of this
  94.                                      agreement.
  95.  
  96.                No warranties are expressed or implied.  In no event
  97.                shall Zephyr Software, Stephen L. Balkum or Daniel A.
  98.                Sill be held liable for damages resulting from the use
  99.                or misuse of this product, including but not limited to
  100.                implied warranties of fitness for a particular purpose.
  101.  
  102.                The shareware version may be freely distributed as long
  103.                as all files stay together and are not modified in any
  104.                way.  No cost may be charged for the shareware version
  105.                beyond normal and reasonable copying and distribution
  106.                expenses.
  107.  
  108.                No products developed with this software shall be sold
  109.                unless this software has been registered with Zephyr
  110.                Software, Stephen L. Balkum or Daniel A. Sill.
  111.  
  112.                At no time for any reason shall this software be
  113.                reverse engineered, decompiled or disassembled.
  114.  
  115.                This software may not be rented or leased.
  116.  
  117.                This software may be used only on one terminal or one
  118.                computer at any one given moment in time.  This
  119.                software may not be installed on a network of any type.
  120.                Contact Zephyr Software, Stephen L. Balkum or Daniel A.
  121.                Sill for networking options.
  122.  
  123.                United States Government Restricted Rights:
  124.                Use, duplication or disclosure of this software and
  125.                documentation by the U.S. Government is subject to the
  126.                restrictions as set forth in subparagraph (c)(1)(ii) of
  127.                the Rights in Technical Data and Computer Software
  128.                clause at DFARS 252.227-7013.  Contractor/manufacturer
  129.                is Stephen L. Balkum and Daniel A. Sill, P.O. Box 7704,
  130.                Austin, Texas 78713-7704.
  131.  
  132.                The ownership of this software may be transferred as
  133.                long as Zephyr Software, Stephen L. Balkum or Daniel A.
  134.                Sill is notified in writing of the transfer date and
  135.                new owner.  The new owner must agree to this contract.
  136.                The transfer must include all registered updates and
  137.                previously registered versions.  The original owner may
  138.                not retain any copies in any form of the registered
  139.                software or its documents.
  140.  
  141.  
  142.  
  143.  
  144.  
  145.                                                                         iii
  146.  
  147.  
  148.  
  149.  
  150.  
  151.           INTRODUCTION
  152.  
  153.           We spent weeks searching the depths of the internet ftp sites for
  154.           a library that would allow the programmer full access to the
  155.           abilities of Super VGA.  We wanted the colors VGA could provide
  156.           and better resolution than EGA could provide.  Professionally
  157.           developed libraries with this ability were definitely out of our
  158.           price range.  After our searches continuously returned nothing,
  159.           we decided to fill the apparent void in the shareware market.
  160.  
  161.           Our searches did give two useful packages:  John Bridges' VGAKIT
  162.           and Finn Thoegersen's VGADOC.  We began with these two works and
  163.           developed a graphics library intended to allow the programmer
  164.           access to the huge world of high resolution programming.
  165.  
  166.           On the surface the task appeared quite simple.  However, it
  167.           quickly became obvious that the routines in this library would be
  168.           required to affect extremely large amounts of data.  Operations
  169.           must be quick to be successful.  Therefore, every effort was made
  170.           to create the fastest code possible - even at the expense of
  171.           size.  For this reason we opted to write code with the 32 bit
  172.           instructions of the 80386 and better processors.  It is our
  173.           opinion that anyone with a hi-res card in a lesser machine may
  174.           have some priorities out of order. All routines are written in
  175.           assembly and use absolutely no floating point values.  Anytime a
  176.           real number was required, fixed point notation was used.  In
  177.           addition we attempted to write the routines such that any
  178.           reasonable argument passed can be interpreted intelligently by
  179.           the library.
  180.  
  181.           With the numerous Super VGA cards available and no well
  182.           established standard we chose John Bridges' identification and
  183.           bank switching routines as a beginning.  These two routines have
  184.           undergone some modification, but not enough to justify
  185.           copyrighting this portion of the library's code by Zephyr
  186.           Software.  We have no intentions of releasing our changes to
  187.           these routines into the public domain.  From that point onward
  188.           all code is original.  In some instances common algorithms were
  189.           researched and original code written according to that algorithm.
  190.  
  191.           This Super VGA library gives the programmer transparent access to
  192.           twenty different Super VGA cards.  These cards include Acumos,
  193.           Ahead, ATI Technologies, Avance, Chips and Technologies, Cirrus
  194.           Logic, Everex, Genoa, MXIC, NCR, Oak Technologies,
  195.           Paradise/Western Digital, Primus, Realtek, Trident, Tseng Labs,
  196.           Video 7 and the VESA standard.  Please see the WHICHVGA function
  197.           for the specific chipsets.  The programmer only needs to verify
  198.           that the end user's card has been identified, but not which card
  199.           was recognized.  After proper identification, all functions react
  200.           in exactly the same fashion.  The library contains functions to
  201.           draw all of the major primitives.  In addition there are
  202.           functions that modify the screen palette, write text on the
  203.           screen with a choice of fonts and modify the reaction of the
  204.           primitives.  Identification routines include not only the video
  205.  
  206.  
  207.                                                                           2
  208.  
  209.  
  210.  
  211.  
  212.  
  213.           card, but also the amount of video memory, type of processor and
  214.           installed pointing devices.  Advanced functions provide full
  215.           mouse support (when used with a Microsoft compatible driver) and
  216.           joystick support.  Finally, support for two dimensional and three
  217.           dimensional coordinate systems is provided including rotation,
  218.           translation, scaling and projection.
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.                                                                           3
  270.  
  271.  
  272.  
  273.  
  274.  
  275.           SUGGESTED METHODS FOR USING THIS LIBRARY
  276.  
  277.           USE WITHIN THE BASIC ENVIRONMENT
  278.  
  279.           We assume that the programmer is familiar with all of the
  280.           capabilities of the Pawer Basic (PB) compiler and environment.
  281.           Understanding of PBLIB is encouraged. If you wish to combine
  282.           SVGAPB.PBL and additional libraries, please see your Power Basic
  283.           Users Manual.
  284.  
  285.           VERIFICATION OF A COMPUTER'S HARDWARE
  286.  
  287.           It is strongly recommended that any program written with this
  288.           library first verifies that the computer is a 80386 or better by
  289.           calling the WHICHCPU function.  Many of the library's functions
  290.           use 386 exclusive code which may cause a computer with a lesser
  291.           processor to crash.  In addition WHICHMOUSE must be called before
  292.           calling any of the mouse functions.  Lastly, it is recommended
  293.           that WHICHJOYSTICK be called before a program uses the joystick
  294.           routines.
  295.  
  296.           It is required that a program call WHICHVGA prior to any function
  297.           that communicates with the video card.  If WHICHVGA returns a
  298.           zero for unknown card type, the program should not call any
  299.           graphics function.  Without proper identification of the video
  300.           card any graphics function will likely cause a system failure.
  301.           It is recommended, although not necessary, that a program call
  302.           WHICHMEM prior to calling any RES function.  Although the video
  303.           card was properly identified, it may not have sufficient onboard
  304.           memory to support the desired resolution.  As a second check the
  305.           RES functions will do nothing if the video card has not been
  306.           identified or if the video card does not support the specified
  307.           resolution for memory or hardware reasons.
  308.  
  309.           THE 256 COLOR PALETTE
  310.  
  311.           The 256 color palette of the Super VGA cards is a six bit
  312.           palette.  Each of the 256 colors of the palette are described by
  313.           three values representing the intensity of the colors red, blue
  314.           and green.  These values can range from 0 to 63.  Anytime a value
  315.           outside of this range is used, the video card simply ignores the
  316.           upper two bits.  Therefore, 64 is the same as 0.  This should be
  317.           taken into consideration when manipulating the palette or when
  318.           importing a palette from an external source such as a PCX image.
  319.  
  320.           USE OF 2-D AND 3-D FUNCTIONS
  321.  
  322.           In the interest of speed, the 2-D and 3-D functions were written
  323.           to best work on multiple points at once.  We refer to these
  324.           functions as object-oriented.  This means that the points
  325.           defining an object (a box, a house, etc.) should be contained
  326.           within one array or part of an array and calls to the functions
  327.           should act on all of the points in the array.  Calls to functions
  328.           have a high speed overhead, therefore, placing more than one
  329.  
  330.  
  331.                                                                           4
  332.  
  333.  
  334.  
  335.  
  336.  
  337.           object in the same array and passing the entire array to the
  338.           functions can be beneficial.  However, these functions will work
  339.           on a single point as well.
  340.  
  341.           A consequence of our object-oriented 2-D and 3-D functions is the
  342.           use of the scaling functions.  When scaling objects, we recommend
  343.           the object be defined about the origin.  D2SCALE and D3SCALE both
  344.           work with respect to the origin.  This eliminates a significant
  345.           number of translations that would otherwise be required by having
  346.           a definable scale origin.  For example, to draw two boxes, one
  347.           scaled by one-half of the other, each rotated by 45 degrees at
  348.           the center of the screen, the recommended procedure is as
  349.           follows:
  350.  
  351.             define an array BOX containing the 2-D points: (100, 100), (-
  352.                100, 100), (-100, -100), (100, -100), (note: the box is
  353.                centered about the origin.)
  354.             rotate BOX by 45 degrees about (0, 0) and place the output in
  355.                RBOX,
  356.             scale RBOX by 50% (scaling factor would be 128, or 80 hex) and
  357.                place output in SRBOX,
  358.             translate RBOX to the center of the screen - a translation of
  359.                320, 240 in 640x480 resolution - and place output in TRBOX,
  360.             translate SRBOX to the center of the screen - same translation
  361.                as for RBOX - and place output in TSRBOX,
  362.             draw TRBOX and TSRBOX on the screen.
  363.  
  364.           Notice that by defining the box centered about the origin the
  365.           translation values were extremely intuitive.  Also notice that if
  366.           we had scaled the second box after the translation, it would have
  367.           been draw in the upper left quadrant of the screen instead of the
  368.           center.
  369.  
  370.           In mathematics and many sciences it is customary that in a 2-D
  371.           coordinate system the Y axis increases upward and the X axis
  372.           increases to the right.  The computer industry has decided the Y
  373.           axis should increase downward.  The 2-D functions are not
  374.           affected by the choice in coordinate systems.  However, it is
  375.           important to remember that a positive rotation in D2ROTATE
  376.           rotates from the positive X axis to the positive Y axis.
  377.           Therefore, when using mathematical conventions, a positive
  378.           rotation moves counter-clockwise.  On the computer screen a
  379.           positive rotation moves clockwise.
  380.  
  381.           The 3-D coordinate system follows mathematical conventions by
  382.           using a right-handed coordinate system.  The easiest way to
  383.           visualize this coordinate system is by using your right hand.
  384.           Place your index finger and thumb at a right angle to one another
  385.           as if to form an imaginary pistol.  Now place your second finger
  386.           at a right angle to your index finger.  It should be at a right
  387.           angle to your thumb as well.  This represents the three axes.
  388.           The index finger is the X axis, the second finger is the Y axis
  389.           and the thumb is the Z axis.  The easiest way to remember
  390.           rotation directions in this system is cyclically.  A positive
  391.  
  392.  
  393.                                                                           5
  394.  
  395.  
  396.  
  397.  
  398.  
  399.           rotation about the X axis rotates the Y axis into the Z axis.  A
  400.           positive rotation about the Y axis rotates the Z axis into the X
  401.           axis.  A positive rotation about the Z axis rotates the X axis
  402.           into the Y axis.
  403.  
  404.           After doing all necessary 3-D transformations, projection onto
  405.           the 2-D computer screen is required.  Although the computer
  406.           screen's coordinate system does not follow mathematical
  407.           conventions, the D3PROJECT function automatically takes care of
  408.           all conversions.  The programmer only needs to draw the resulting
  409.           object on the screen with FILLCONVEXPOLY, FILLPOLY or a series of
  410.           DRWLINEs.
  411.  
  412.           THE CONCEPT OF SPRITE GRAPHICS
  413.  
  414.           The key to sprite graphics is the assumption that only a small
  415.           percentage of the pixels in a graphics block are used by the
  416.           animation and the remaining pixels should be treated as
  417.           transparent, revealing the background behind the sprite.  The
  418.           sprite routines in this library only act on non-transparent
  419.           colors, thus, saving time by ignoring a large number of pixels.
  420.           When retrieving the background for a sprite, prior knowledge of
  421.           the sprite itself permits obtaining background only where it is
  422.           necessary.
  423.  
  424.           The following steps outline an example of the recommended
  425.           procedure for using the sprite functions:
  426.  
  427.             1. draw the sprite on the screen - a white stick figure on a
  428.                black background, for example
  429.             2. use BLKGET to place the sprite in an array STICK
  430.             3. use SPRITEGAP to simultaneously retrieve the background into
  431.                BACKSTICK and place STICK on the screen, declaring black as
  432.                the transparent color
  433.             4. use SPRITEPUT to replace the background BACKSTICK in the
  434.                same location as step 3
  435.             5. repeat steps 3 and 4 as many times and in as many locations
  436.                as desired
  437.  
  438.           EXTENDED MEMORY SUPPORT
  439.  
  440.           With the higher screen resolutions, more memory may be needed for
  441.           data storage.  For this reason extended memory support is
  442.           provided.  Accessing extended memory requires the computer to
  443.           switch into protected mode.  The process of switching into
  444.           protected mode and returning is handled by the extended memory
  445.           manager, usually HIMEM.SYS.  The switch is relatively slow.
  446.           Therefore, it should be used as fast storage access since it is
  447.           much faster than disk access.
  448.  
  449.           Extended memory access is also limited by the number of available
  450.           handles.  The limit is controlled by a switch on the extended
  451.           memory manager's command line and normally defaults to 32.  Also,
  452.           it is imperative that all allocated extended memory blocks be
  453.  
  454.  
  455.                                                                           6
  456.  
  457.  
  458.  
  459.  
  460.  
  461.           freed before the program terminates.  Unfreed memory blocks will
  462.           be unavailable until the computer is rebooted.
  463.  
  464.           CONVENTIONS USED IN THIS MANUAL
  465.  
  466.           All parameters, other than strings, passed to and from functions
  467.           and procedures in this QuickBasic library are short (two byte)
  468.           integers.  No floating point values are used.
  469.  
  470.           Whenever a pixel is written on the screen, a mode is required.
  471.           Unless otherwise noted, there are four possible modes:  SET, XOR,
  472.           OR and AND.  These modes are represented by the numbers one
  473.           through four respectively.  Technically, SET is the fastest mode.
  474.           However, XOR maybe the most useful.  XOR'ing a point twice with
  475.           the same color returns the original color.  This can be used to
  476.           cover and uncover graphics.  In addition when a reference to a
  477.           color index is made, only values between and including 0 and 255
  478.           are valid.  Any integer will work, but only the lowest eight bits
  479.           are recognized.
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.                                                                           7
  518.  
  519.  
  520.  
  521.  
  522.  
  523.           BLKGET
  524.  
  525.             PROTOTYPE
  526.  
  527.             SUB BLKGET (X1%, Y1%, X2%, Y2%, GfxBlk%)
  528.  
  529.             INPUT
  530.  
  531.             X1, Y1 - top left corner of block
  532.             X2, Y2 - bottom right corner of block
  533.  
  534.             OUTPUT
  535.  
  536.             If declared as a function, BLKGET returns 1 if successful, 0
  537.             if failed.
  538.             GfxBlk - integer destination array holding retrieved bitmap
  539.  
  540.             USAGE
  541.  
  542.             BLKGET stores the pixel data contained within the block
  543.             defined by (X1, Y1)-(X2, Y2) in the variable referenced by
  544.             GfxBlk.  GfxBlk must be dimensioned as a short integer array
  545.             with a size in integers equal to
  546.                              [(X2-X1+1)*(Y2-Y1+1)] / 2+3.
  547.             Note, however, that GfxBlk can be quite large.  If the size of
  548.             GfxBlk is insufficient, BLKGET will overwrite any data in
  549.             memory contained beyond GfxBlk and may possibly cause the
  550.             system to crash.  BLKGET enforces X2 X1 and Y2Y1.  Also, the
  551.             coordinates must be valid on the screen at the current
  552.             resolution.
  553.  
  554.             The bitmap is stored such that the first integer in the
  555.             destination array is the width and the second integer is the
  556.             height.  The remaining bytes are the bitmap raster data stored
  557.             by rows starting at the top of the block.
  558.  
  559.             Arrays should be passed by giving the element within the array
  560.             from where the action should take place.  This allows the
  561.             programmer to store more than one item within the same array
  562.             or act on only a portion of the array.
  563.  
  564.             SEE ALSO
  565.  
  566.             BLKPUT, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  567.             SPRITEGET, SPRITEPUT, XMSBLKGET, XMSBLKPUT
  568.  
  569.             EXAMPLE
  570.  
  571.             REM PLACES 1/4 OF A CIRCLE AT THE CENTER OF THE SCREEN
  572.             $LINK "SVGAPB.PBL"
  573.             $INCLUDE "SVGAPB.BI"
  574.             DEFINT A-Z
  575.             DIM BLOCKDATA(483) AS INTEGER
  576.             IF WHICHVGA = 0 THEN STOP
  577.  
  578.  
  579.                                                                           8
  580.  
  581.  
  582.  
  583.  
  584.  
  585.             DUMMY=RES640
  586.             DRWCIRCLE 1, 10, 30, 30, 20
  587.             FILLAREA 30, 30, 10, 7
  588.             BLKGET 0, 0, 30, 30, BLOCKDATA(0)
  589.             BLKPUT 1, 320, 240, BLOCKDATA(0)
  590.             WHILE INKEY$ = "" : WEND
  591.             DUMMY=RESTEXT
  592.             END
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.                                                                           9
  642.  
  643.  
  644.  
  645.  
  646.  
  647.           BLKPUT
  648.  
  649.             PROTOTYPE
  650.  
  651.             SUB BLKPUT (Mode%, X%, Y%, GfxBlk%)
  652.  
  653.             INPUT
  654.  
  655.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  656.             X, Y - location for top left corner of block
  657.             GfxBlk - integer source array
  658.  
  659.             OUTPUT
  660.  
  661.             no value returned
  662.  
  663.             USAGE
  664.  
  665.             BLKPUT places the pixel data contained in the variable
  666.             referenced by GfxBlk on the screen.  The top, left corner of
  667.             the block is specified by (X, Y).  Any (X, Y) is acceptable
  668.             and any portion of the block that lies outside of the
  669.             currently defined viewport will not be drawn.
  670.  
  671.             Arrays should be passed by giving the element within the array
  672.             from where the action should take place.  This allows the
  673.             programmer to store more than one item within the same array
  674.             or act on only a portion of the array.
  675.  
  676.             SEE ALSO
  677.  
  678.             BLKGET, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  679.             SPRITEGET, SPRITEPUT, PCXPUT, SETVIEW, XMSBLKGET, XMSBLKPUT
  680.  
  681.             EXAMPLE
  682.  
  683.             See BLKGET
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.                                                                          10
  704.  
  705.  
  706.  
  707.  
  708.  
  709.           BLKRESIZE
  710.  
  711.             PROTOTYPE
  712.  
  713.             SUB BLKRESIZE (X%, Y%, SourceGfxBlk%, DestGfxBlk%)
  714.  
  715.             INPUT
  716.  
  717.             NewXSize, NewYSize - size of resulting bitmap in DestGfxBlk
  718.             SourceGfxBlk - integer source array
  719.  
  720.             OUTPUT
  721.  
  722.             no value returned
  723.             DestGfxBlk - integer destination array holding resized bitmap
  724.  
  725.             USAGE
  726.  
  727.             BLKRESIZE takes the bitmap in SourceGfxBlk and scales it up or
  728.             down according the to values passed in NewXSize and NewYSize.
  729.             The resulting bitmap is returned in DestGfxBlk which should
  730.             already be declared with a size calculated according to the
  731.             equation in BLKGET.  NewXSize and NewYSize should not be zero.
  732.  
  733.             SEE ALSO
  734.  
  735.             BLKGET, BLKPUT, BLKROTATE
  736.  
  737.             EXAMPLE
  738.  
  739.             REM  RESIZE A BITMAP
  740.             $LINK "SVGAPB.PBL"
  741.             $INCLUDE "SVGAPB.BI"
  742.             DEFINT A-Z
  743.             DIM SRC%(0 TO 32000)
  744.             DIM DST%(0 TO 32000)
  745.  
  746.             IF WHICHCPU < 386 THEN END
  747.             IF WHICHVGA = 0 THEN END
  748.             VMODE=VIDEOMODEGET
  749.             IF RES640 <> 1 THEN
  750.                 DUMMY = RESTEXT
  751.                 END
  752.             END IF
  753.             X1 = 0
  754.             Y1 = 0
  755.             X2 = 50
  756.             Y2 = 50
  757.             FOR I = 0 TO 25
  758.                 XA = (RND * X2 - X1) + X1
  759.                 YA = (RND * Y2 - Y1) + Y1
  760.                 XB = (RND * X2 - X1) + X1
  761.                 YB = (RND * Y2 - Y1) + Y1
  762.                 C = RND * 16
  763.  
  764.  
  765.                                                                          11
  766.  
  767.  
  768.  
  769.  
  770.  
  771.                 DRWLINE 1, C, XA, YA, XB, YB
  772.             NEXT I
  773.             DRWBOX 1, 15, X1, Y1, X2, Y2
  774.             BLKGET X1, Y1, X2, Y2, SRC(0)
  775.             X1 = GETMAXX \ 2
  776.             Y1 = GETMAXY \ 2
  777.             X = SRC(0) + 1
  778.             Y = SRC(1) + 1
  779.             BLKRESIZE X, Y, SRC(0), DST(0)
  780.             BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  781.             FOR I = X TO X + 50
  782.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  783.                 BLKRESIZE I, I, SRC(0), DST(0)
  784.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  785.                 SDELAY 3
  786.             NEXT I
  787.             FOR I = X + 50 TO X - 50 STEP -1
  788.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  789.                 BLKRESIZE I, I, SRC(0), DST(0)
  790.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  791.                 SDELAY 3
  792.             NEXT I
  793.             FOR I = X - 50 TO X
  794.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  795.                 BLKRESIZE I, I, SRC(0), DST(0)
  796.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  797.                 SDELAY 3
  798.             NEXT I
  799.             VIDEOMODESET VMODE
  800.             END
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.                                                                          12
  828.  
  829.  
  830.  
  831.  
  832.  
  833.           BLKROTATE
  834.  
  835.             PROTOTYPE
  836.  
  837.             FUNCTION BLKROTATE% (Ang%, BackFill%, SourceGfxBlk%,
  838.             DestGfxBlk%)
  839.  
  840.             INPUT
  841.  
  842.             Ang - integer degree to rotate source bitmap
  843.             BackFillColor - index to color in current palette to fill
  844.             blank space in DestGfxBlk
  845.             SourceGfxBlk - integer source array
  846.  
  847.             OUTPUT
  848.  
  849.             BLKROTATE returns 1 if successful, 0 if unsuccessful.
  850.             DestGfxBlk - integer destination array holding rotated bitmap
  851.  
  852.             USAGE
  853.  
  854.             BLKROTATE takes the bitmap in SourceGfxBlk and rotates by the
  855.             number of degrees specified in Ang.  The bitmap rotation
  856.             algorithm is a three-pass shear technique modified to make
  857.             efficient use of this library's internal buffers.  Blank space
  858.             around the newly rotated block is filled with the color given
  859.             by BackFillColor.  The resulting bitmap is stored in
  860.             DestGfxBlk.  The size of DestGfxBlk should be at least as big
  861.             as given by BLKROTATESIZE.
  862.  
  863.             The function will fail if it calculates that the internal
  864.             buffers would be overflowed or if the destination array would
  865.             be larger than 65536 bytes.  BLKROTATESIZE should be called
  866.             first to ensure that buffer integrity is maintained.
  867.  
  868.             SEE ALSO
  869.  
  870.             BLKGET, BLKPUT, BLKRESIZE, BLKROTATESIZE
  871.  
  872.             EXAMPLE
  873.  
  874.             REM ROTATE A BITMAP
  875.             $LINK "SVGAPB.PBL"
  876.             $INCLUDE "SVGAPB.BI"
  877.             DEFINT A-Z
  878.             DIM SRC%(0 TO 32000)
  879.             DIM DST%(0 TO 32000)
  880.             IF WHICHCPU < 386 THEN END
  881.             IF WHICHVGA = 0 THEN END
  882.             VMODE = VIDEOMODEGET
  883.             IF RES640 <> 1 THEN
  884.                 DUMMY = RESTEXT
  885.                 END
  886.             END IF
  887.  
  888.  
  889.                                                                          13
  890.  
  891.  
  892.  
  893.  
  894.  
  895.             X1 = 0
  896.             Y1 = 0
  897.             X2 = 110
  898.             Y2 = 110
  899.             FOR I = 0 TO 50
  900.                 XA = (RND * X2 - X1) + X1
  901.                 YA = (RND * Y2 - Y1) + Y1
  902.                 XB = (RND * X2 - X1) + X1
  903.                 YB = (RND * Y2 - Y1) + Y1
  904.                 C = RND * 16
  905.                 DRWLINE 1, C, XA, YA, XB, YB
  906.             NEXT I
  907.             DRWBOX 1, 15, X1, Y1, X2, Y2
  908.             BLKGET X1, Y1, X2, Y2, SRC(0)
  909.             X1 = GETMAXX \ 2
  910.             Y1 = GETMAXY \ 2
  911.             FOR I = 0 TO 359 STEP 6
  912.                 IF BLKROTATESIZE(I, SRC(0)) <> 0 THEN
  913.                  DUMMY = BLKROTATE(I, 0, SRC(0), DST(0))
  914.                  BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  915.                  SDELAY 3
  916.                  BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  917.                 END IF
  918.             NEXT I
  919.             VIDEOMODESET VMODE
  920.             END
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.                                                                          14
  952.  
  953.  
  954.  
  955.  
  956.  
  957.           BLKROTATESIZE
  958.  
  959.             PROTOTYPE
  960.  
  961.             FUNCTION BLKROTATESIZE& (Ang%, SourceGfxBlk%)
  962.  
  963.             INPUT
  964.  
  965.             Ang - integer degree to rotate source bitmap
  966.             SourceGfxBlk - integer source array
  967.  
  968.             OUTPUT
  969.  
  970.             BLKROTATESIZE returns the number of bytes needed for the
  971.             destination array if successful, 0 if unsuccessful.
  972.  
  973.             USAGE
  974.  
  975.             BLKROTATESIZE takes the bitmap in SourceGfxBlk calculates the
  976.             required size of the output buffer needed when BLKROTATE is
  977.             called.  It also insures that the internal library buffers are
  978.             not overflowed.  The function will fail if it calculates that
  979.             the internal buffers would be overflowed or if the destination
  980.             array would be larger than 65536 bytes.  BLKROTATESIZE should
  981.             be called prior to BLKROTATE to ensure that buffer integrity
  982.             is maintained.
  983.  
  984.             SEE ALSO
  985.  
  986.             BLKGET, BLKPUT, BLKRESIZE, BLKROTATE
  987.  
  988.             EXAMPLE
  989.  
  990.             See BLKROTATE
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.                                                                          15
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.           BYTECOPY
  1020.  
  1021.             PROTOTYPE
  1022.  
  1023.             SUB BYTECOPY (Source AS ANY, Dest AS ANY, NumOfBytes&)
  1024.  
  1025.             INPUT
  1026.  
  1027.             Source - item to be copied
  1028.             NumBytes - number of bytes to copy from SrcArray to DestArray
  1029.  
  1030.             OUTPUT
  1031.  
  1032.             no value returned
  1033.             Dest - destination holding copied data
  1034.  
  1035.             USAGE
  1036.  
  1037.             BYTECOPY copies the specified number of bytes from Source to
  1038.             Dest.  It is much faster than using a FOR/NEXT loop.  NumBytes
  1039.             is equal to the number of bytes to be copied.  For example, if
  1040.             Source contains 10 integers to be copied, NumBytes is 2 * 10,
  1041.             or 20 bytes.  The declaration for BYTECOPY permits any
  1042.             variable type to be copied.  However, BYTECOPY will not work
  1043.             with strings.  It will copy strings contained with a user
  1044.             defined type.  Remember that real numbers and long integers
  1045.             are 4 bytes.
  1046.  
  1047.             Arrays should be passed by giving the element within the array
  1048.             from where the action should take place.  This allows the
  1049.             programmer to store more than one item within the same array
  1050.             or act on only a portion of the array.
  1051.  
  1052.             SEE ALSO
  1053.  
  1054.             PALCOPY
  1055.  
  1056.             EXAMPLE
  1057.  
  1058.             REM SHOW HOW BYTE COPY WORKS ON MANY DATA TYPES
  1059.             REM REMEBER: INTEGER=2 BYTES; LONG INTEGER=4 BYTES;
  1060.             REM SINGLE REAL=4 BYTES; LONG REAL=8 BYTES; USER DEFINED
  1061.             REM VARIABLES MUST BE CACULATED BY THEIR INDIVIDUAL PARTS;
  1062.             $INCLUDE "SVGAPB.BI"
  1063.             $LINK "SVGAPB.PBL"
  1064.  
  1065.             TYPE MyType
  1066.                CustNum AS INTEGER
  1067.                CustAmnt AS SINGLE
  1068.                CustName AS STRING * 20
  1069.             END TYPE
  1070.  
  1071.             DEFINT A-Z
  1072.  
  1073.  
  1074.  
  1075.                                                                          16
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.             DIM CA(0 TO 1) AS MyType
  1082.             DIM CB(0 TO 1) AS MyType
  1083.             DIM IntAryA(0 TO 2) AS INTEGER
  1084.             DIM IntAryB(0 TO 2) AS INTEGER
  1085.             DIM SingleAry(0 TO 5) AS SINGLE
  1086.             DIM LongAryA(0 TO 2) AS LONG
  1087.             DIM LongAryB(0 TO 2) AS LONG
  1088.             DIM LongRealAryA(0 TO 2) AS DOUBLE
  1089.             DIM LongRealAryB(0 TO 2) AS DOUBLE
  1090.  
  1091.             FOR I = 0 TO 1
  1092.                READ CA(I).CustNum
  1093.                READ CA(I).CustAmnt
  1094.                READ CA(I).CustName
  1095.             NEXT I
  1096.             FOR I = 0 TO 2
  1097.                READ IntAryA(I)
  1098.             NEXT I
  1099.             FOR I = 0 TO 2
  1100.                READ SingleAry(I)
  1101.             NEXT I
  1102.             FOR I = 0 TO 2
  1103.                READ LongAryA(I)
  1104.             NEXT I
  1105.             FOR I = 0 TO 2
  1106.                READ LongRealAryA(I)
  1107.             NEXT I
  1108.  
  1109.             REM HERE WE DO THE COPIES
  1110.             BYTECOPY CA(0), CB(0), 48
  1111.             BYTECOPY IntAryA(0), IntAryB(0), 6
  1112.             BYTECOPY SingleAry(0), SingleAry(3), 12
  1113.             BYTECOPY LongAryA(0), LongAryB(0), 12
  1114.             BYTECOPY LongRealAryA(0), LongRealAryB(0), 24
  1115.  
  1116.             PRINT "-------HERE ARE USER DEFINED ARRAYS:-------"
  1117.             FOR I = 0 TO 1
  1118.                PRINT CA(I).CustName; TAB(40); CB(I).CustName
  1119.                PRINT CA(I).CustNum; TAB(40); CB(I).CustNum
  1120.                PRINT CA(I).CustAmnt; TAB(40); CB(I).CustAmnt
  1121.             NEXT I
  1122.             PRINT "------HERE ARE SHORT INTEGER ARRAYS:-------"
  1123.             FOR I = 0 TO 2
  1124.                PRINT IntAryA(I); TAB(40); IntAryB(I)
  1125.             NEXT I
  1126.             PRINT "-------HERE ARE SHORT REAL ARRAYS:---------"
  1127.             FOR I = 0 TO 2
  1128.                PRINT SingleAry(I); TAB(40); SingleAry(I + 3)
  1129.             NEXT I
  1130.             PRINT "-------HERE ARE LONG INTEGER ARRAYS:-------"
  1131.             FOR I = 0 TO 2
  1132.                PRINT LongAryA(I); TAB(40); LongAryB(I)
  1133.             NEXT I
  1134.             PRINT "-------HERE ARE LONG REAL ARRAYS:----------"
  1135.  
  1136.  
  1137.                                                                          17
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.             FOR I = 0 TO 2
  1144.                PRINT LongRealAryA(I); TAB(40); LongRealAryB(I)
  1145.             NEXT I
  1146.             WHILE INKEY$ = ""
  1147.             WEND
  1148.  
  1149.             REM CUSTOMER DATA
  1150.             DATA 102,120.98,"John Doe"
  1151.             DATA 182,160.23,"Jane Smith"
  1152.  
  1153.             REM INTEGER DATA
  1154.             DATA 2,62,9456
  1155.  
  1156.             REM SINGLE REAL DATA
  1157.             DATA 1.23,45.342,13.13
  1158.  
  1159.             REM LONG INTEGER DATA
  1160.             DATA 45000,92538,101234
  1161.  
  1162.             REM LONG REAL DATA
  1163.             DATA 345.45345,834.923734,485344.456
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.                                                                          18
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.           D2ROTATE
  1206.  
  1207.             PROTOTYPE
  1208.  
  1209.             SUB D2ROTATE (Points%, XOrigin%, YOrigin%, Ang%, InAry%,
  1210.             OutAry%)
  1211.  
  1212.             INPUT
  1213.  
  1214.             NumPoints - number of points to be rotated
  1215.             Xorigin, Yorigin - center of rotation
  1216.             Angle - angle of rotation about center
  1217.             InArray - P2DType array containing points to rotate
  1218.  
  1219.             OUTPUT
  1220.  
  1221.             no value returned
  1222.             OutArray - P2DType array holding rotated values
  1223.  
  1224.             USAGE
  1225.  
  1226.             D2ROTATE takes the two dimensional points given in InArray and
  1227.             rotates them by the specified angle about Xorigin, Yorigin.
  1228.             The results are returned in OutArray which can be the same as
  1229.             InArray.  A positive angle causes a clockwise rotation on the
  1230.             screen, from the positive X axis to the positive Y axis.
  1231.  
  1232.             Arrays should be passed by giving the element within the array
  1233.             from where the action should take place.  This allows the
  1234.             programmer to store more than one item within the same array
  1235.             or act on only a portion of the array.
  1236.  
  1237.             SEE ALSO
  1238.  
  1239.             D2SCALE, D2TRANSLATE
  1240.  
  1241.             EXAMPLE
  1242.  
  1243.             REM ROTATE A TRIANGLE ABOUT ONE CORNER
  1244.             $LINK "SVGAPB.PBL"
  1245.             $INCLUDE "SVGAPB.BI"
  1246.             DEFINT A-Z
  1247.             DIM TRIO(1 TO 3) AS P2DType
  1248.             DIM TRI(1 TO 3) AS P2DType
  1249.             DIM TRI2(1 TO 3) AS P2DType
  1250.  
  1251.             TRIO(1).X = 0
  1252.             TRIO(1).Y = 0
  1253.             TRIO(2).X = -80
  1254.             TRIO(2).Y = 60
  1255.             TRIO(3).X = 80
  1256.             TRIO(3).Y = 60
  1257.             VMODE = VIDEOMODEGET
  1258.             IF WHICHVGA = 0 THEN STOP
  1259.  
  1260.  
  1261.                                                                          19
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.             DUMMY=RES640
  1268.             GOSUB DRWTRI
  1269.             FOR I = 0 TO 360 STEP 2
  1270.             D2ROTATE 3, 0, 0, I, TRIO(1).X, TRI(1).X
  1271.             GOSUB DRWTRI
  1272.             SDELAY 2
  1273.             GOSUB ERTRI
  1274.             NEXT I
  1275.             GOSUB DRWTRI
  1276.             WHILE INKEY$ = ""
  1277.             WEND
  1278.             VIDEOMODESET VMODE
  1279.             END
  1280.  
  1281.             DRWTRI:
  1282.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1283.             DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1284.             DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1285.             DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1286.             RETURN
  1287.  
  1288.             ERTRI:
  1289.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1290.             DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1291.             DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1292.             DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1293.             RETURN
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.                                                                          20
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.           D2SCALE
  1330.  
  1331.             PROTOTYPE
  1332.  
  1333.             SUB D2SCALE (Points%, ScaleX%, ScaleY%, InArray%, OutArray%)
  1334.  
  1335.             INPUT
  1336.  
  1337.             NumPoints - number of points to scale
  1338.             ScaleX - scale factor along X axis
  1339.             ScaleY - scale factor along Y axis
  1340.             InArray - P2DType array containing points to scale
  1341.  
  1342.             OUTPUT
  1343.  
  1344.             no value returned
  1345.             OutArray - P2DType array holding scaled values
  1346.  
  1347.             USAGE
  1348.  
  1349.             D2SCALE multiplies each coordinate in the two dimensional
  1350.             array InArray by the corresponding scale factor ScaleX or
  1351.             ScaleY.  The results are stored in OutArray which can be the
  1352.             same as InArray.  A scale factor of 256 (100 hex) is
  1353.             considered 100 percent and results in no change.  Therefore,
  1354.             128 (80 hex) reduces values by one half and 512 (200 hex)
  1355.             doubles values.
  1356.  
  1357.             Arrays should be passed by giving the element within the array
  1358.             from where the action should take place.  This allows the
  1359.             programmer to store more than one item within the same array
  1360.             or act on only a portion of the array.
  1361.  
  1362.             SEE ALSO
  1363.  
  1364.             D2ROTATE, D2TRANSLATE
  1365.  
  1366.             EXAMPLE
  1367.  
  1368.             REM SCALE A TRIANGLE
  1369.             $LINK "SVGAPB.PBL"
  1370.             $INCLUDE "SVGAPB.BI"
  1371.             DEFINT A-Z
  1372.             DIM TRIO(1 TO 3) AS P2DType
  1373.             DIM TRI(1 TO 3) AS P2DType
  1374.             DIM TRI2(1 TO 3) AS P2DType
  1375.  
  1376.             TRIO(1).X = 0
  1377.             TRIO(1).Y = 0
  1378.             TRIO(2).X = -80
  1379.             TRIO(2).Y = 60
  1380.             TRIO(3).X = 80
  1381.             TRIO(3).Y = 60
  1382.             VMODE = VIDEOMODEGET
  1383.  
  1384.  
  1385.                                                                          21
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.             IF WHICHVGA = 0 THEN STOP
  1392.             DUMMY=RES640
  1393.             GOSUB DRWTRI
  1394.             FOR I = 256 TO 512 STEP 4
  1395.             D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1396.             GOSUB DRWTRI
  1397.             SDELAY 2
  1398.             GOSUB ERTRI
  1399.             NEXT I
  1400.             FOR I = 512 TO 128 STEP -4
  1401.             D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1402.             GOSUB DRWTRI
  1403.             SDELAY 2
  1404.             GOSUB ERTRI
  1405.             NEXT I
  1406.  
  1407.             FOR I = 128 TO 256 STEP 4
  1408.             D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1409.             GOSUB DRWTRI
  1410.             SDELAY 2
  1411.             GOSUB ERTRI
  1412.             NEXT I
  1413.             GOSUB DRWTRI
  1414.             WHILE INKEY$ = ""
  1415.             WEND
  1416.             VIDEOMODESET VMODE
  1417.             END
  1418.  
  1419.             DRWTRI:
  1420.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1421.             DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1422.             DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1423.             DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1424.             RETURN
  1425.  
  1426.             ERTRI:
  1427.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1428.             DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1429.             DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1430.             DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1431.             RETURN
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                                                                          22
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.           D2TRANSLATE
  1454.  
  1455.             PROTOTYPE
  1456.  
  1457.             SUB D2TRANSLATE (Points%, TransX%, TransY%, InArray%,
  1458.             OutArray%)
  1459.  
  1460.             INPUT
  1461.  
  1462.             NumPoints - number of points to be translated
  1463.             TransX - distance to translate along X axis
  1464.             TransY - distance to translate along Y axis
  1465.             InArray - P2DType array containing points to translate
  1466.  
  1467.             OUTPUT
  1468.  
  1469.             no value returned
  1470.             OutArray - P2DType array holding translated values
  1471.  
  1472.             USAGE
  1473.  
  1474.             D2TRANSLATE takes the two dimensional points given in InArray
  1475.             and translates them by the specified number of pixels along
  1476.             each axis.  The results are returned in OutArray which can be
  1477.             the same as InArray.
  1478.  
  1479.             Arrays should be passed by giving the element within the array
  1480.             from where the action should take place.  This allows the
  1481.             programmer to store more than one item within the same array
  1482.             or act on only a portion of the array.
  1483.  
  1484.             SEE ALSO
  1485.  
  1486.             D2ROTATE, D2SCALE
  1487.  
  1488.             EXAMPLE
  1489.  
  1490.             REM TRANSLATE A TRIANGLE
  1491.             $LINK "SVGAPB.PBL"
  1492.             $INCLUDE "SVGAPB.BI"
  1493.             DEFINT A-Z
  1494.             DIM TRIO(1 TO 3) AS P2DType
  1495.             DIM TRI(1 TO 3) AS P2DType
  1496.             DIM TRI2(1 TO 3) AS P2DType
  1497.  
  1498.             TRIO(1).X = 0
  1499.             TRIO(1).Y = 0
  1500.             TRIO(2).X = -80
  1501.             TRIO(2).Y = 60
  1502.             TRIO(3).X = 80
  1503.             TRIO(3).Y = 60
  1504.             VMODE = VIDEOMODEGET
  1505.             IF WHICHVGA = 0 THEN STOP
  1506.             DUMMY=RES640
  1507.  
  1508.  
  1509.                                                                          23
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.             GOSUB DRWTRI
  1516.             FOR I = 0 TO 100 STEP 4
  1517.             D2TRANSLATE 3, I, I, TRIO(1).X, TRI(1).X
  1518.             GOSUB DRWTRI
  1519.             SDELAY 2
  1520.             GOSUB ERTRI
  1521.             NEXT I
  1522.             FOR I = 100 TO 0 STEP -4
  1523.             D2TRANSLATE 3, I, I, TRIO(1).X, TRI(1).X
  1524.             GOSUB DRWTRI
  1525.             SDELAY 2
  1526.             GOSUB ERTRI
  1527.             NEXT I
  1528.             GOSUB DRWTRI
  1529.             WHILE INKEY$ = ""
  1530.             WEND
  1531.             VIDEOMODESET VMODE
  1532.             END
  1533.  
  1534.             DRWTRI:
  1535.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1536.             DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1537.             DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1538.             DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1539.             RETURN
  1540.  
  1541.             ERTRI:
  1542.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1543.             DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1544.             DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1545.             DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1546.             RETURN
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.                                                                          24
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.           D3PROJECT
  1578.  
  1579.             PROTOTYPE
  1580.  
  1581.             FUNCTION D3PROJECT% (Points%, ProjParms%, InArray%, OutArray%)
  1582.  
  1583.             INPUT
  1584.  
  1585.             NumPoints - number of points to be projected
  1586.             ProjParams - PROJType structure containing parameters used in
  1587.             projection
  1588.                EyeX, EyeY, EyeZ - 3D location of viewer
  1589.                ScrD - distance from viewer to projection screen
  1590.                Theta - angle from positive 3D X axis to viewing direction
  1591.                Phi - angle from positive 3D Z axis to viewing direction
  1592.             InArray - P3DType array containing points to project
  1593.  
  1594.             OUTPUT
  1595.  
  1596.             D3PROJECT returns 1 if successful, 0 if any one point failed.
  1597.             OutArray - P2DType array holding projected values
  1598.  
  1599.             USAGE
  1600.                                 +Z axis
  1601.                                    |                   /\
  1602.                                    |                  /  \
  1603.                                    |            !     \ * \
  1604.                                    |            !......X: /
  1605.                                    |            ! Phi / \/
  1606.                                    |            !    /  :
  1607.                                    |            !   /   :
  1608.                                    |            !  /    :
  1609.                                    |       EyeX ! /ScrD :
  1610.                                    |       EyeY !/      :
  1611.                                    |       EyeZ *- - - -:- - - - -
  1612.                                    |           / `      :
  1613.                                    |          /   `     :
  1614.                                    |         /      `   :
  1615.                                    |        /      ---` :
  1616.                                    |       /___----
  1617.                                    |      /     Theta
  1618.                                    |
  1619.                                    |_____________________________+Y axis
  1620.                                    /
  1621.                                   /
  1622.                                  /
  1623.                                 /
  1624.                                /
  1625.                               /
  1626.                              /
  1627.                          +X axis
  1628.  
  1629.             D3PROJECT projects a specified number, NumPoints, of three
  1630.             dimensional points starting at InArray into two dimensions
  1631.  
  1632.  
  1633.                                                                          25
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.             according to the parameters in ProjParams.  The two
  1640.             dimensional points are stored in OutArray.  The location of
  1641.             the viewer in this three dimensional space is given by EyeX,
  1642.             EyeY, EyeZ in the ProjParams structure.  The direction the
  1643.             viewer is facing is specified with ScrD, Theta, Phi in the
  1644.             ProjParams structure using spherical coordinates.  A virtual
  1645.             set of axes parallel to the true axes are placed at the
  1646.             viewer's location.  ScrD is the distance from the viewer to
  1647.             the center of the projection screen, i.e. the currently
  1648.             defined viewport on the monitor's screen.  Theta is the angle
  1649.             in the virtual X-Y plane from the virtual X axis to the
  1650.             projection screen.  Positive angles rotate counter-clockwise
  1651.             in the X-Y plane.  Lastly, the angle of elevation above or
  1652.             below the virtual X-Y plane is given by Phi.  Positive angles
  1653.             direct viewing above the plane; negative below.
  1654.  
  1655.             If a point is projected to a location behind the viewer, i.e.
  1656.             on the side of the viewer opposite the projection screen,
  1657.             D3PROJECT returns a zero indicating one or more failed points.
  1658.             The returned values of the X and Y for failed points will be -
  1659.             32768 to make them easily identified.
  1660.  
  1661.             Arrays should be passed by giving the element within the array
  1662.             from where the action should take place.  This allows the
  1663.             programmer to store more than one item within the same array
  1664.             or act on only a portion of the array.
  1665.  
  1666.             SEE ALSO
  1667.  
  1668.             D3ROTATE, D3TRANSLATE, D3SCALE, FILLCONVEXPOLY, SETVIEW
  1669.  
  1670.             EXAMPLE
  1671.  
  1672.             REM DRAW A CUBE AT THE CENTER OF THE SCREEN
  1673.             $LINK "SVGAPB.PBL"
  1674.             $INCLUDE "SVGAPB.BI"
  1675.             DEFINT A-Z
  1676.             DIM CUBE(1 TO 8) AS P3DType
  1677.             DIM PLOT(1 TO 8) AS P2DType
  1678.             DIM PROJPARAMS AS PROJType
  1679.  
  1680.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1681.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1682.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1683.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1684.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1685.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1686.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1687.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1688.             VMODE = VIDEOMODEGET
  1689.             IF WHICHVGA = 0 THEN STOP
  1690.             DUMMY=RES640
  1691.             PROJPARAMS.EYEX = -1040
  1692.             PROJPARAMS.EYEY = -600
  1693.  
  1694.  
  1695.                                                                          26
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.             PROJPARAMS.EYEZ = -1200
  1702.             PROJPARAMS.SCRD = 1700
  1703.             PROJPARAMS.THETA = 30
  1704.             PROJPARAMS.PHI = 45
  1705.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,CUBE(1).X,PLOT(1).X)
  1706.             GOSUB DRWCUBE
  1707.             WHILE INKEY$ = ""
  1708.             WEND
  1709.             VIDEOMODESET VMODE
  1710.             END
  1711.  
  1712.             DRWCUBE:
  1713.             FOR J=1 TO 3
  1714.             DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1715.             NEXT J
  1716.             DRWLINE 1, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1717.             FOR J=5 TO 7
  1718.             DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1719.             NEXT J
  1720.             DRWLINE 1, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1721.             FOR J=1 TO 4
  1722.             DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1723.             NEXT J
  1724.             RETURN
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.                                                                          27
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.           D3ROTATE
  1764.  
  1765.             PROTOTYPE
  1766.  
  1767.             SUB D3ROTATE (Points%, X%, Y%, Z%, AngleZ%, AngleY%, AngleX%,
  1768.             InArray%, OutArray%)
  1769.  
  1770.             INPUT
  1771.  
  1772.             NumPoints - number of points to be rotated
  1773.             X, Y, Z - center of rotation
  1774.             AngleZ - angle of rotation about the Z axis
  1775.             AngleY - angle of rotation about the Y axis
  1776.             AngleX - angle of rotation about the X axis
  1777.             InArray - P3DType array containing points to rotate
  1778.  
  1779.             OUTPUT
  1780.  
  1781.             no value returned
  1782.             OutArray - P3DType array holding rotated values
  1783.  
  1784.             USAGE
  1785.  
  1786.             D3ROTATE takes the three dimensional points given in InArray
  1787.             and rotates them by the specified angles about Xorigin,
  1788.             Yorigin, Zorigin.  The results are returned in OutArray which
  1789.             can be the same as InArray.  A virtual set of axes are placed
  1790.             at the origin of rotation and rotation takes place about these
  1791.             axes.  A positive angle causes a counter-clockwise rotation
  1792.             from the positive X axis to the positive Y axis.
  1793.  
  1794.             Arrays should be passed by giving the element within the array
  1795.             from where the action should take place.  This allows the
  1796.             programmer to store more than one item within the same array
  1797.             or act on only a portion of the array.
  1798.  
  1799.             SEE ALSO
  1800.  
  1801.             D3PROJECT, D3SCALE, D3TRANSLATE
  1802.  
  1803.             EXAMPLE
  1804.  
  1805.             REM ROTATE A CUBE AT THE CENTER OF THE SCREEN
  1806.             $LINK "SVGAPB.PBL"
  1807.             $INCLUDE "SVGAPB.BI"
  1808.             DEFINT A-Z
  1809.             DIM CUBE(1 TO 8) AS P3DType
  1810.             DIM RCUBE(1 TO 8) AS P3DType
  1811.             DIM PLOT(1 TO 8) AS P2DType
  1812.             DIM PROJPARAMS AS PROJType
  1813.  
  1814.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1815.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1816.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1817.  
  1818.  
  1819.                                                                          28
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1826.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1827.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1828.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1829.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1830.             VMODE = VIDEOMODEGET
  1831.             IF WHICHVGA = 0 THEN STOP
  1832.             DUMMY=RES640
  1833.             PROJPARAMS.EYEX = -1040
  1834.             PROJPARAMS.EYEY = -600
  1835.             PROJPARAMS.EYEZ = -1200
  1836.             PROJPARAMS.SCRD = 1700
  1837.             PROJPARAMS.THETA = 30
  1838.             PROJPARAMS.PHI = 45
  1839.             FOR I = 0 TO 360 STEP 5
  1840.             D3ROTATE 8, 0, 0, 0, I, I, I, CUBE(1).X, RCUBE(1).X
  1841.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,RCUBE(1).X,PLOT(1).X)
  1842.             GOSUB DRWCUBE
  1843.             SDELAY 2
  1844.             GOSUB DRWCUBE
  1845.             NEXT I
  1846.             WHILE INKEY$ = ""
  1847.             WEND
  1848.             VIDEOMODESET VMODE
  1849.             END
  1850.  
  1851.             DRWCUBE:
  1852.             FOR J=1 TO 3
  1853.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1854.             NEXT J
  1855.             DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1856.             FOR J=5 TO 7
  1857.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1858.             NEXT J
  1859.             DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1860.             FOR J=1 TO 4
  1861.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1862.             NEXT J
  1863.             RETURN
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.                                                                          29
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.           D3SCALE
  1888.  
  1889.             PROTOTYPE
  1890.  
  1891.             D3SCALE (Points%, ScaleX%, ScaleY%, ScaleZ%, InArray%,
  1892.             OutArray%)
  1893.  
  1894.             INPUT
  1895.  
  1896.             NumPoints - number of points to scale
  1897.             ScaleX - scale factor along X axis
  1898.             ScaleY - scale factor along Y axis
  1899.             ScaleZ - scale factor along Z axis
  1900.             InArray - P3DType array containing points to scale
  1901.  
  1902.             OUTPUT
  1903.  
  1904.             no value returned
  1905.             OutArray - P3DType array holding scaled values
  1906.  
  1907.             USAGE
  1908.  
  1909.             D3SCALE multiplies each coordinate in the three dimensional
  1910.             array InArray by the corresponding scale factor ScaleX, ScaleY
  1911.             or ScaleZ.  The results are stored in OutArray which can be
  1912.             the same as InArray.  A scale factor of 256 (100 hex) is
  1913.             considered 100 percent and results in no change.  Therefore,
  1914.             128 (80 hex) reduces values by one half and 512 (200 hex)
  1915.             doubles values.
  1916.  
  1917.             Arrays should be passed by giving the element within the array
  1918.             from where the action should take place.  This allows the
  1919.             programmer to store more than one item within the same array
  1920.             or act on only a portion of the array.
  1921.  
  1922.             SEE ALSO
  1923.  
  1924.             D3PROJECT, D3ROTATE, D3TRANSLATE
  1925.  
  1926.             EXAMPLE
  1927.  
  1928.             REM SCALE A CUBE AT THE CENTER OF THE SCREEN
  1929.             $LINK "SVGAPB.PBL"
  1930.             $INCLUDE "SVGAPB.BI"
  1931.             DEFINT A-Z
  1932.             DIM CUBE(1 TO 8) AS P3DType
  1933.             DIM SCUBE(1 TO 8) AS P3DType
  1934.             DIM PLOT(1 TO 8) AS P2DType
  1935.             DIM PROJPARAMS AS PROJType
  1936.  
  1937.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1938.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1939.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1940.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1941.  
  1942.  
  1943.                                                                          30
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1950.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1951.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1952.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1953.             VMODE = VIDEOMODEGET
  1954.             IF WHICHVGA = 0 THEN STOP
  1955.             DUMMY=RES640
  1956.             PROJPARAMS.EYEX = -1040
  1957.             PROJPARAMS.EYEY = -600
  1958.             PROJPARAMS.EYEZ = -1200
  1959.             PROJPARAMS.SCRD = 1700
  1960.             PROJPARAMS.THETA = 30
  1961.             PROJPARAMS.PHI = 45
  1962.             FOR I = 256 TO 128 STEP -4
  1963.             D3SCALE 8, I, I, I, CUBE(1).X, SCUBE(1).X
  1964.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,SCUBE(1).X,PLOT(1).X)
  1965.             GOSUB DRWCUBE
  1966.             SDELAY 2
  1967.             GOSUB DRWCUBE
  1968.             NEXT I
  1969.             FOR I = 132 TO 256 STEP 4
  1970.             D3SCALE 8, I, I, I, CUBE(1).X, SCUBE(1).X
  1971.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,SCUBE(1).X,PLOT(1).X)
  1972.             GOSUB DRWCUBE
  1973.             SDELAY 2
  1974.             GOSUB DRWCUBE
  1975.             NEXT I
  1976.             WHILE INKEY$ = ""
  1977.             WEND
  1978.             VIDEOMODESET VMODE
  1979.             END
  1980.  
  1981.             DRWCUBE:
  1982.             FOR J=1 TO 3
  1983.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1984.             NEXT J
  1985.             DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1986.             FOR J=5 TO 7
  1987.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1988.             NEXT J
  1989.             DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1990.             FOR J=1 TO 4
  1991.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1992.             NEXT J
  1993.             RETURN
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.                                                                          31
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.           D3TRANSLATE
  2012.  
  2013.             PROTOTYPE
  2014.  
  2015.             SUB D3TRANSLATE (Points%, TransX%, TransY%, TransZ%, InArray%,
  2016.             OutArray%)
  2017.  
  2018.             INPUT
  2019.  
  2020.             NumPoints - number of points to translate
  2021.             TransX - distance to translate along X axis
  2022.             TransY - distance to translate along Y axis
  2023.             TransZ - distance to translate along Z axis
  2024.             InArray - P3DType array containing points to translate
  2025.  
  2026.             OUTPUT
  2027.  
  2028.             no value returned
  2029.             OutArray - P3DType array holding translated points
  2030.  
  2031.             USAGE
  2032.  
  2033.             D3TRANSLATE takes the three dimensional points given in
  2034.             InArray and translates them by the specified number of pixels
  2035.             along each axis.  The results are returned in OutArray which
  2036.             can be the same as InArray.
  2037.  
  2038.             Arrays should be passed by giving the element within the array
  2039.             from where the action should take place.  This allows the
  2040.             programmer to store more than one item within the same array
  2041.             or act on only a portion of the array.
  2042.  
  2043.             SEE ALSO
  2044.  
  2045.             D3PROJECT, D3ROTATE, D3SCALE
  2046.  
  2047.             EXAMPLE
  2048.  
  2049.             REM TRANSLATE A CUBE NEAR THE CENTER OF THE SCREEN
  2050.             $LINK "SVGAPB.PBL"
  2051.             $INCLUDE "SVGAPB.BI"
  2052.             DEFINT A-Z
  2053.             DIM CUBE(1 TO 8) AS P3DType
  2054.             DIM TCUBE(1 TO 8) AS P3DType
  2055.             DIM PLOT(1 TO 8) AS P2DType
  2056.             DIM PROJPARAMS AS PROJType
  2057.  
  2058.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  2059.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  2060.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  2061.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  2062.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  2063.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  2064.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  2065.  
  2066.  
  2067.                                                                          32
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  2074.             VMODE = VIDEOMODEGET
  2075.             IF WHICHVGA = 0 THEN STOP
  2076.             DUMMY=RES640
  2077.             PROJPARAMS.EYEX = -1040
  2078.             PROJPARAMS.EYEY = -600
  2079.             PROJPARAMS.EYEZ = -1200
  2080.             PROJPARAMS.SCRD = 1700
  2081.             PROJPARAMS.THETA = 30
  2082.             PROJPARAMS.PHI = 45
  2083.             FOR I = 0 TO 100 STEP 2
  2084.             D3TRANSLATE 8, I, I, I, CUBE(1).X, TCUBE(1).X
  2085.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,TCUBE(1).X,PLOT(1).X)
  2086.             GOSUB DRWCUBE
  2087.             SDELAY 2
  2088.             GOSUB DRWCUBE
  2089.             NEXT I
  2090.             FOR I = 98 TO 0 STEP -2
  2091.             D3TRANSLATE 8, I, I, I, CUBE(1).X, TCUBE(1).X
  2092.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,TCUBE(1).X,PLOT(1).X)
  2093.             GOSUB DRWCUBE
  2094.             SDELAY 2
  2095.             GOSUB DRWCUBE
  2096.             NEXT I
  2097.             WHILE INKEY$ = ""
  2098.             WEND
  2099.             VIDEOMODESET VMODE
  2100.             END
  2101.  
  2102.             DRWCUBE:
  2103.             FOR J=1 TO 3
  2104.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  2105.             NEXT J
  2106.             DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  2107.             FOR J=5 TO 7
  2108.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  2109.             NEXT J
  2110.             DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  2111.             FOR J=1 TO 4
  2112.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  2113.             NEXT J
  2114.             RETURN
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.                                                                          33
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.             DRWALINE
  2136.  
  2137.             PROTOTYPE
  2138.  
  2139.             DRWALINE (ColrBits%, Colr%, X1%, Y1%, X2%, Y2%)
  2140.  
  2141.             INPUT
  2142.  
  2143.             ColrBits - number of bits of color
  2144.             Colr - index to color in current palette
  2145.             X1, Y1 - location of one endpoint of line
  2146.             X2, Y2 - location of other endpoint of line
  2147.  
  2148.             OUTPUT
  2149.  
  2150.             no value returned
  2151.  
  2152.             USAGE
  2153.  
  2154.             DRWALINE draws an antialiased line of the specified color
  2155.             using with endpoints located at (X1, Y1) and (X2,Y2).
  2156.             Antialiased lines trick the eye into seeing true vector lines
  2157.             instead of a jagged series of individual pixels.  This is
  2158.             accomplished by drawing two pixels of the same color but with
  2159.             different intensities (brightness) for each pixel drawn by
  2160.             DRWALINE.  The eye averages them to see only a straight line.
  2161.             Note that the palette must be set up with the correct color
  2162.             entries for the line to look correct. All values of X1, Y1, X2
  2163.             and Y2 are valid.  Any portion of the line that lies outside
  2164.             of the currently defined viewport will not be drawn.  ColrBits
  2165.             should be a number in the range of 0 to 6 specifying the
  2166.             number of shades of color in the palette (20 =1 is one color
  2167.             shade; 26=64 is 64 shades of color).  These shades should be
  2168.             contiguous in the palette from index colr to index (colr +
  2169.             2colrbits - 1) starting with the full desired brightness.  The
  2170.             best compromise of detail versus palette entries is about 3
  2171.             (23=8 is 8 shades, or palette entries, of color).
  2172.  
  2173.             SEE ALSO
  2174.  
  2175.             DRWLINE, DRWBOX, SETVIEW
  2176.  
  2177.             EXAMPLE
  2178.  
  2179.             REM THIS SHOWS NORMAL AND ANTIALISED LINES TOGETHER
  2180.             $LINK "SVGAPB.PBL"
  2181.             $INCLUDE "SVGAPB.BI"
  2182.             DEFINT A-Z
  2183.             DIM Pal(255) AS RGBType
  2184.  
  2185.             CLS
  2186.             IF WHICHVGA = 0 THEN STOP
  2187.             DUMMY = RES640
  2188.             REM SET UP THE PALETTE
  2189.  
  2190.  
  2191.                                                                          34
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.             INTSBITS = 2
  2198.             NUMLEVELS = 2 ^ INTSBITS
  2199.             PALGET PAL(0), 0, 255
  2200.             FOR I = 0 TO NUMLEVELS - 1
  2201.                OFST = 16 + I
  2202.                PAL(OFST).R = 63 - 35 * I / (NUMLEVELS - 1)
  2203.                PAL(OFST).G = 63 - 35 * I / (NUMLEVELS - 1)
  2204.                PAL(OFST).B = 63 - 35 * I / (NUMLEVELS - 1)
  2205.             NEXT I
  2206.             PALSET PAL(0), 0, 255
  2207.             OFST = GETMAXY / 2 - 1
  2208.             YA = GETMAXY / 3
  2209.             YB = 2 * GETMAXY / 3
  2210.             FOR Y = 0 TO OFST STEP 12
  2211.                DRWLINE 1, 15, 0, YA, GETMAXX, Y
  2212.                DRWALINE INTSBITS, 16, 0, YB, GETMAXX, OFST + Y
  2213.             NEXT Y
  2214.             WHILE INKEY$ = ""
  2215.             WEND
  2216.             DUMMY = RESTEXT
  2217.             END
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.                                                                          35
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.           DRWBOX
  2260.  
  2261.             PROTOTYPE
  2262.  
  2263.             SUB DRWBOX (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2264.  
  2265.             INPUT
  2266.  
  2267.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2268.             Color - index to color in current palette
  2269.             X1, Y1 - location of top left corner
  2270.             X2, Y2 - location of bottom right corner
  2271.  
  2272.             OUTPUT
  2273.  
  2274.             no value returned
  2275.  
  2276.             USAGE
  2277.  
  2278.             DRWBOX draws a rectangle of the color specified using Mode
  2279.             with opposite vertices defined by (X1, Y1) and (X2, Y2).  The
  2280.             vertices given do not need to be exactly the top left and
  2281.             bottom right.  They only have to reference opposite sides of
  2282.             the rectangle.  Any portion of the rectangle that lies outside
  2283.             of the currently defined viewport will not be drawn.
  2284.  
  2285.             SEE ALSO
  2286.  
  2287.             DRWFILLBOX, DRWLINE, SETVIEW
  2288.  
  2289.             EXAMPLE
  2290.  
  2291.             REM DRAWS A BOX AROUND THE WHOLE SCREEN
  2292.             $LINK "SVGAPB.PBL"
  2293.             $INCLUDE "SVGAPB.BI"
  2294.             DEFINT A-Z
  2295.  
  2296.             VMODE=VIDEOMODEGET
  2297.             IF WHICHVGA = 0 THEN STOP
  2298.             DUMMY=RES640
  2299.             DRWBOX 1, 10, 0, 0, 639, 479
  2300.             WHILE INKEY$ = ""
  2301.             WEND
  2302.             VIDEOMODESET VMODE
  2303.             END
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.                                                                          36
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.           DRWCIRARC
  2322.  
  2323.             PROTOTYPE
  2324.  
  2325.             SUB DRWCIRARC (Mode%, Color%, Xcenter%, Ycenter%, Radius%,
  2326.             StartAng&, EndAang&)
  2327.  
  2328.             INPUT
  2329.  
  2330.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2331.             Color - index to color in current palette
  2332.             Xcenter, Ycenter - location of center of circle
  2333.             Radius - distance from center to edge of circle
  2334.             StartAng, EndAng - start and end angles in degrees
  2335.  
  2336.             OUTPUT
  2337.  
  2338.             no value returned
  2339.  
  2340.             USAGE
  2341.  
  2342.             DRWCIRARC draws a circular  arc of the specified color and
  2343.             mode with the center located at (Xcenter, Ycenter), radius of
  2344.             Radius, starting at the angle specified by StartAng and ending
  2345.             at the angle specified by EndAng.  All values of Xcenter,
  2346.             Ycenter, Radius, StartAng, and EndAng are valid.  However,
  2347.             StartAng must be less than EndAng.  Any portion of the arc
  2348.             that lies outside of the currently defined viewport will not
  2349.             be drawn.
  2350.  
  2351.             SEE ALSO
  2352.  
  2353.             DRWCIRCLE, DRWELLARC
  2354.  
  2355.             EXAMPLE
  2356.  
  2357.             REM DRAWS SOME CIRCULAR ARCS
  2358.             $LINK "SVGAPB.PBL"
  2359.             $INCLUDE "SVGAPB.BI"
  2360.             DEFINT A-Z
  2361.  
  2362.             IF WHICHVGA = 0 THEN END
  2363.             DUMMY = RES640
  2364.             FOR I = 1 TO 60
  2365.                R = I * 5
  2366.                SANG = I * 6
  2367.                DRWCIRARC 1, 10, GETMAXX \ 2, GETMAXY \ 2, R, SANG, 360
  2368.             NEXT I
  2369.             WHILE INKEY$ = ""
  2370.             WEND
  2371.             DUMMY = RESTEXT
  2372.             CLS
  2373.             END
  2374.  
  2375.  
  2376.  
  2377.                                                                          37
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.           DRWCIRCLE
  2384.  
  2385.             PROTOTYPE
  2386.  
  2387.             SUB DRWCIRCLE (Mode%, Color%, Xcenter%, Ycenter%, Radius%)
  2388.  
  2389.             INPUT
  2390.  
  2391.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2392.             Color - index to color in current palette
  2393.             Xcenter, Ycenter - location of center of circle
  2394.             Radius - distance from center to edge of circle
  2395.  
  2396.             OUTPUT
  2397.  
  2398.             no value returned
  2399.  
  2400.             USAGE
  2401.  
  2402.             DRWCIRCLE draws a circle of the specified color using Mode
  2403.             with the center located at (Xcenter, Ycenter) and a radius of
  2404.             Radius.  All values of Xcenter, Ycenter and Radius are valid.
  2405.             Any portion of the circle that lies outside of the currently
  2406.             defined viewport will not be drawn.
  2407.  
  2408.             SEE ALSO
  2409.  
  2410.             DRWCIRARC, DRWELLIPSE, DRWFILLCIRCLE, SETVIEW
  2411.  
  2412.             EXAMPLE
  2413.  
  2414.             REM DRAWS A CIRCLE AT THE CENTER OF THE SCREEN
  2415.             $LINK "SVGAPB.PBL"
  2416.             $INCLUDE "SVGAPB.BI"
  2417.             DEFINT A-Z
  2418.  
  2419.             VMODE=VIDEOMODEGET
  2420.             IF WHICHVGA = 0 THEN STOP
  2421.             DUMMY=RES640
  2422.             DRWCIRCLE 1, 10, 320, 240, 200
  2423.             WHILE INKEY$ = ""
  2424.             WEND
  2425.             VIDEOMODESET VMODE
  2426.             END
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.                                                                          38
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.           DRWCUBICBEZIER
  2446.  
  2447.             PROTOTYPE
  2448.  
  2449.             SUB DRWCUBICBEZIER (Mode%, Color%, Pon1%, Poff1%, Poff2%,
  2450.             Pon2%)
  2451.  
  2452.             INPUT
  2453.  
  2454.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2455.             Color - index to color in current palette
  2456.             Pon1% - P2DType variable containing the start point
  2457.             Poff1% - P2DType variable containing the first offset point
  2458.             Poff2% - P2DType variable containing the second offset point
  2459.             Pon2% - P2DType variable containing the end  point
  2460.  
  2461.             OUTPUT
  2462.  
  2463.             no value returned
  2464.  
  2465.             USAGE
  2466.  
  2467.             DRWCUBICBEZIER draws a standard cubic Bezier curve connecting
  2468.             the points Pon1 and Pon2 using the specified mode and color.
  2469.             The off-curve control points are Poff1 and Poff2.  A technical
  2470.             description of cubic Bezier curves is beyond the scope of this
  2471.             manual.  However, most advanced computer graphics texts
  2472.             contain discussions on this topic.
  2473.  
  2474.             SEE ALSO
  2475.  
  2476.             DRWCIRARC, DRWELLARC
  2477.  
  2478.             EXAMPLE
  2479.  
  2480.             REM SHOW DRWCUBICBEZIER
  2481.             $LINK "SVGAPB.PBL"
  2482.             $INCLUDE "SVGAPB.BI"
  2483.             DEFINT A-Z
  2484.  
  2485.             DIM P(3) AS P2DType
  2486.  
  2487.             IF WHICHCPU < 386 THEN END
  2488.             IF WHICHVGA = 0 THEN END
  2489.             IF RES640 <> 1 THEN
  2490.                DUMMY = RESTEXT
  2491.                END
  2492.             END IF
  2493.  
  2494.             P(0).X = 260
  2495.             P(0).Y = 240
  2496.  
  2497.             P(1).X = 310
  2498.             P(1).Y = 360
  2499.  
  2500.  
  2501.                                                                          39
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.             P(2).X = 330
  2509.             P(2).Y = 120
  2510.  
  2511.             P(3).X = 380
  2512.             P(3).Y = 240
  2513.  
  2514.             DRWCIRCLE 1, 12, P(0).X, P(0).Y, 2
  2515.             DRWCIRCLE 1, 12, P(1).X, P(1).Y, 2
  2516.             DRWCIRCLE 1, 12, P(2).X, P(2).Y, 2
  2517.             DRWCIRCLE 1, 12, P(3).X, P(3).Y, 2
  2518.  
  2519.             DRWCUBICBEZIER 1, 15, P(0).X, P(1).X, P(2).X, P(3).X
  2520.  
  2521.             WHILE INKEY$ = ""
  2522.             WEND
  2523.             DUMMY = RESTEXT
  2524.             CLS
  2525.             END
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.                                                                          40
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.           DRWELLARC
  2570.  
  2571.             PROTOTYPE
  2572.  
  2573.             SUB DRWELLARC (Mode%, Color%, Xcenter%, Ycenter%, RadiusX%,
  2574.             RadiusX%, StartAng&, EndAang&)
  2575.  
  2576.             INPUT
  2577.  
  2578.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2579.             Color - index to color in current palette
  2580.             Xcenter, Ycenter - location of center of ellipse
  2581.             RadiusX - radius parallel to X axis
  2582.             RadiusY - radius parallel to Y axis
  2583.             StartAng, EndAng - start and end angles in degrees
  2584.  
  2585.             OUTPUT
  2586.  
  2587.             no value returned
  2588.  
  2589.             USAGE
  2590.  
  2591.             DRWELLARC draws an elliptical  arc of the specified color and
  2592.             mode with the center located at (Xcenter, Ycenter).  The
  2593.             radius in the horizontal direction is RaduisX and the radius
  2594.             in the vertical direction is RadiusY.  The starting angle is
  2595.             specified by StartAng and ends at the angle specified by
  2596.             EndAng.  All values of Xcenter, Ycenter, RadiusX, RadiusY,
  2597.             StartAng and EndAng are valid.  However, StartAng must be less
  2598.             than EndAng.  Any portion of the arc that lies outside of the
  2599.             currently defined viewport will not be drawn.
  2600.  
  2601.             SEE ALSO
  2602.  
  2603.             DRWCIRARC, DRWELLIPSE
  2604.  
  2605.             EXAMPLE
  2606.  
  2607.             REM DRAWS SOME ELLIPTICAL ARCS
  2608.             $LINK "SVGAPB.PBL"
  2609.             $INCLUDE "SVGAPB.BI"
  2610.             DEFINT A-Z
  2611.  
  2612.             IF WHICHVGA = 0 THEN END
  2613.             DUMMY = RES640
  2614.             FOR I = 1 TO 60
  2615.                RX = I * 5
  2616.                RY = I * 3
  2617.                SANG = I * 6
  2618.                DRWELLARC 1, 10, GETMAXX \ 2, GETMAXY \ 2, RX, RY, SANG, 360
  2619.             NEXT I
  2620.             WHILE INKEY$ = ""
  2621.             WEND
  2622.             DUMMY = RESTEXT
  2623.  
  2624.  
  2625.                                                                          41
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.             CLS
  2632.             END
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.                                                                          42
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.           DRWELLIPSE
  2694.  
  2695.             PROTOTYPE
  2696.  
  2697.             SUB DRWELLIPSE (Mode%, Color%, Xcenter%, Ycenter%, RadiusX%,
  2698.             RadiusY%)
  2699.  
  2700.             INPUT
  2701.  
  2702.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2703.             Color - index to color in current palette
  2704.             Xcenter, Ycenter - location of center of ellipse
  2705.             RadiusX - radius parallel to X axis
  2706.             RadiusY - radius parallel to Y axis
  2707.  
  2708.             OUTPUT
  2709.  
  2710.             no value returned
  2711.  
  2712.             USAGE
  2713.  
  2714.             DRWELLIPSE draws an ellipse of the specified color using Mode
  2715.             with the center defined by (Xcenter, Ycenter).  The radius in
  2716.             the horizontal direction is RaduisX and the radius in the
  2717.             vertical direction is RadiusY.  All values of Xcenter,
  2718.             Ycenter, RadiusX and RadiusY are valid.  Any portion of the
  2719.             ellipse that lies outside of the currently defined viewport
  2720.             will not be drawn.
  2721.  
  2722.             SEE ALSO
  2723.  
  2724.             DRWCIRCLE, DRWELLARC, DRWFILLELLIPSE, SETVIEW
  2725.  
  2726.             EXAMPLE
  2727.  
  2728.             REM DRAWS AN ELLIPSE AT THE CENTER OF THE SCREEN
  2729.             $LINK "SVGAPB.PBL"
  2730.             $INCLUDE "SVGAPB.BI"
  2731.             DEFINT A-Z
  2732.  
  2733.             VMODE=VIDEOMODEGET
  2734.             IF WHICHVGA = 0 THEN STOP
  2735.             DUMMY=RES640
  2736.             DRWELLIPSE 1, 10, 320, 240, 318, 238
  2737.             WHILE INKEY$ = ""
  2738.             WEND
  2739.             VIDEOMODESET VMODE
  2740.             END
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.                                                                          43
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.           DRWFILLBOX
  2756.  
  2757.             PROTOTYPE
  2758.  
  2759.             SUB DRWFILLBOX (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2760.  
  2761.             INPUT
  2762.  
  2763.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2764.             Color - index to color in current palette
  2765.             X1, Y1 - location of top left corner
  2766.             X2, Y2 - location of bottom right corner
  2767.  
  2768.             OUTPUT
  2769.  
  2770.             no value returned
  2771.  
  2772.             USAGE
  2773.  
  2774.             DRWFILLBOX draws a filled rectangle of the color specified
  2775.             using Mode with opposite vertices defined by (X1, Y1) and (X2,
  2776.             Y2).  The vertices given do not need to be exactly the top
  2777.             left and bottom right.  They only have to reference opposite
  2778.             sides of the rectangle.  Any portion of the rectangle that
  2779.             lies outside of the currently defined viewport will not be
  2780.             drawn.
  2781.  
  2782.             SEE ALSO
  2783.  
  2784.             DRWBOX, DRWLINE, FILLCONVEXPOLY, FILLPOLY, SETVIEW
  2785.  
  2786.             EXAMPLE
  2787.  
  2788.             REM DRAWS A FILLED BOX
  2789.             $LINK "SVGAPB.PBL"
  2790.             $INCLUDE "SVGAPB.BI"
  2791.             DEFINT A-Z
  2792.  
  2793.             VMODE = VIDEOMODEGET
  2794.             IF WHICHVGA = 0 THEN STOP
  2795.             DUMMY = RES640
  2796.             DRWFILLBOX 1, 10, 100, 100, 200, 200
  2797.             WHILE INKEY$ = ""
  2798.             WEND
  2799.             VIDEOMODESET VMODE
  2800.             END
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.                                                                          44
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.           DRWFILLCIRCLE
  2818.  
  2819.             PROTOTYPE
  2820.  
  2821.             SUB DRWFILLCIRCLE (Mode%, Color%, Xcenter%, Ycenter%, Radius%)
  2822.  
  2823.             INPUT
  2824.  
  2825.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2826.             Color - index to color in current palette
  2827.             Xcenter, Ycenter - location of center of circle
  2828.             Radius - distance from center to edge of circle
  2829.  
  2830.             OUTPUT
  2831.  
  2832.             no value returned
  2833.  
  2834.             USAGE
  2835.  
  2836.             DRWFILLCIRCLE draws a filled circle of the specified color
  2837.             using Mode with the center located at (Xcenter, Ycenter) and a
  2838.             radius of Radius.  All values of Xcenter, Ycenter and Radius
  2839.             are valid.  Any portion of the circle that lies outside of the
  2840.             currently defined viewport will not be drawn.
  2841.  
  2842.             SEE ALSO
  2843.  
  2844.             DRWCIRCLE, SETVIEW
  2845.  
  2846.             EXAMPLE
  2847.  
  2848.             REM DRAWS A FILLED CIRCLE
  2849.             $LINK "SVGAPB.PBL"
  2850.             $INCLUDE "SVGAPB.BI"
  2851.             DEFINT A-Z
  2852.  
  2853.             VMODE = VIDEOMODEGET
  2854.             IF WHICHVGA = 0 THEN STOP
  2855.             DUMMY = RES640
  2856.             DRWFILLCIRCLE 1, 10, 320, 240, 50
  2857.             WHILE INKEY$ = ""
  2858.             WEND
  2859.             VIDEOMODESET VMODE
  2860.             END
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.                                                                          45
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.           DRWFILLELLIPSE
  2880.  
  2881.             PROTOTYPE
  2882.  
  2883.             SUB DRWFILLELLIPSE (Mode%, Color%, Xcenter%, Ycenter%,
  2884.             RadiusX%, RadiusY%)
  2885.  
  2886.             INPUT
  2887.  
  2888.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2889.             Color - index to color in current palette
  2890.             Xcenter, Ycenter - location of center of ellipse
  2891.             RadiusX - radius parallel to X axis
  2892.             RadiusY - radius parallel to Y axis
  2893.  
  2894.             OUTPUT
  2895.  
  2896.             no value returned
  2897.  
  2898.             USAGE
  2899.  
  2900.             DRWFILLELLIPSE draws a filled ellipse of the specified color
  2901.             using Mode with the center defined by (Xcenter, Ycenter).  The
  2902.             radius in the horizontal direction is RaduisX and the radius
  2903.             in the vertical direction is RadiusY.  All values of Xcenter,
  2904.             Ycenter, RadiusX and RadiusY are valid.  Any portion of the
  2905.             ellipse that lies outside of the currently defined viewport
  2906.             will not be drawn.
  2907.  
  2908.             SEE ALSO
  2909.  
  2910.             DRWELLIPSE, SETVIEW
  2911.  
  2912.             EXAMPLE
  2913.  
  2914.             REM DRAWS A FILLED ELLIPSE]
  2915.             $LINK "SVGAPB.PBL"
  2916.             $INCLUDE "SVGAPB.BI"
  2917.             DEFINT A-Z
  2918.  
  2919.             VMODE = VIDEOMODEGET
  2920.             IF WHICHVGA = 0 THEN STOP
  2921.             DUMMY = RES640
  2922.             DRWFILLELLIPSE 1, 10, 320, 240, 118, 50
  2923.             WHILE INKEY$ = ""
  2924.             WEND
  2925.             VIDEOMODESET VMODE
  2926.             END
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.                                                                          46
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.           DRWLINE
  2942.  
  2943.             PROTOTYPE
  2944.  
  2945.             SUB DRWLINE (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2946.  
  2947.             INPUT
  2948.  
  2949.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  2950.             Color - index to color in current palette
  2951.             X1, Y1 - location of one endpoint of line
  2952.             X2, Y2 - location of other endpoint of line
  2953.  
  2954.             OUTPUT
  2955.  
  2956.             no value returned
  2957.  
  2958.             USAGE
  2959.  
  2960.             DRWLINE draws a line of the specified color using Mode with
  2961.             endpoints located at (X1, Y1) and (X2, Y2).  All values of X1,
  2962.             Y1, X2 and Y2 are valid.  Any portion of the line that lies
  2963.             outside of the currently defined viewport will not be drawn.
  2964.  
  2965.             SEE ALSO
  2966.  
  2967.             DRWALINE, DRWBOX, SETVIEW
  2968.  
  2969.             EXAMPLE
  2970.  
  2971.             REM DRAWS A LINE FROM 0,0 TO THE CENTER OF THE SCREEN
  2972.             $LINK "SVGAPB.PBL"
  2973.             $INCLUDE "SVGAPB.BI"
  2974.             DEFINT A-Z
  2975.  
  2976.             VMODE=VIDEOMODEGET
  2977.             IF WHICHVGA = 0 THEN STOP
  2978.             DUMMY=RES640
  2979.             DRWLINE 1, 10, 0, 0, 320, 240
  2980.             WHILE INKEY$ = ""
  2981.             WEND
  2982.             VIDEOMODESET VMODE
  2983.             END
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.                                                                          47
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.           DRWPOINT
  3004.  
  3005.             PROTOTYPE
  3006.  
  3007.             SUB DRWPOINT (Mode%, Color%, X%, Y%)
  3008.  
  3009.             INPUT
  3010.  
  3011.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  3012.             Color - index to color in current palette
  3013.             X, Y - location of pixel to write
  3014.  
  3015.             OUTPUT
  3016.  
  3017.             no value returned
  3018.  
  3019.             USAGE
  3020.  
  3021.             DRWPOINT draws a single point of the specified color using
  3022.             Mode at (X, Y).  All values of X and Y are valid.  If the
  3023.             point (X, Y) lies outside of the currently defined viewport,
  3024.             no drawing will take place.
  3025.  
  3026.             SEE ALSO
  3027.  
  3028.             GETPOINT, SETVIEW
  3029.  
  3030.             EXAMPLE
  3031.  
  3032.             REM DRAWS A POINT AT THE CENTER OF THE SCREEN
  3033.             $LINK "SVGAPB.PBL"
  3034.             $INCLUDE "SVGAPB.BI"
  3035.             DEFINT A-Z
  3036.  
  3037.             VMODE=VIDEOMODEGET
  3038.             IF WHICHVGA = 0 THEN STOP
  3039.             DUMMY=RES640
  3040.             DRWPOINT 1, 10, 320, 240
  3041.             WHILE INKEY$ = ""
  3042.             WEND
  3043.             VIDEOMODESET VMODE
  3044.             END
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.                                                                          48
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.           DRWSTRING
  3066.  
  3067.             PROTOTYPE
  3068.  
  3069.             SUB DRWSTRING (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  3070.  
  3071.             INPUT
  3072.  
  3073.             Mode - pixel write mode (no action=0, SET=1, XOR=2, OR=3,
  3074.             AND=4)
  3075.             FColor - foreground index to color in current palette
  3076.             BColor - background index to color in current palette
  3077.             Strng$ - string of ASCII characters to be drawn
  3078.             X, Y - location of upper, left corner of block
  3079.  
  3080.             OUTPUT
  3081.  
  3082.             no value returned
  3083.  
  3084.             USAGE
  3085.  
  3086.             DRWSTRING takes the ASCII characters contained in Strng$ and
  3087.             creates a graphics block similar to the blocks used by Blkget
  3088.             and Blkput and places this block on the screen at the
  3089.             specified coordinates.  The characters are drawn with color
  3090.             FColor using the current font and the background is color
  3091.             BColor.  When mode 0, no action, is used, the graphics block
  3092.             is created in memory retrievable by GETLASTSTRING, but no text
  3093.             is actually drawn on the screen.  (Note: the system font is
  3094.             automatically installed when WHICHVGA is called.)
  3095.  
  3096.             SEE ALSO
  3097.  
  3098.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRINGDN, DRWSTRINGLT,
  3099.             DRWSTRINGRT, GETLASTSTRING
  3100.  
  3101.             EXAMPLE
  3102.  
  3103.             REM DRAWS SOME NORMAL TEXT AT THE CENTER OF THE SCREEN
  3104.             $LINK "SVGAPB.PBL"
  3105.             $INCLUDE "SVGAPB.BI"
  3106.             DEFINT A-Z
  3107.  
  3108.             VMODE=VIDEOMODEGET
  3109.             IF WHICHVGA = 0 THEN STOP
  3110.             DUMMY=RES640
  3111.             A$ = "HELLO WORLD"
  3112.             DRWSTRING 1, 10, 0, A$, 320, 240
  3113.             WHILE INKEY$ = ""
  3114.             WEND
  3115.             VIDEOMODESET VMODE
  3116.             END
  3117.  
  3118.  
  3119.  
  3120.  
  3121.                                                                          49
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.           DRWSTRINGDN
  3128.  
  3129.             PROTOTYPE
  3130.  
  3131.             SUB DRWSTRINGDN (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  3132.  
  3133.             INPUT
  3134.  
  3135.             Mode - pixel write mode (no action=0, SET=1, XOR=2, OR=3,
  3136.             AND=4)
  3137.             FColor - foreground index to color in current palette
  3138.             BColor - background index to color in current palette
  3139.             Strng$ - string of ASCII characters to be drawn
  3140.             X, Y - location of lower, right corner of block
  3141.  
  3142.             OUTPUT
  3143.  
  3144.             no value returned
  3145.  
  3146.             USAGE
  3147.  
  3148.             DRWSTRINGDN takes the ASCII characters contained in Strng$ and
  3149.             creates a graphics block similar to the blocks used by Blkget
  3150.             and Blkput.  The characters are drawn with color FColor using
  3151.             the current font and the background is color BColor.  When
  3152.             mode 0, no action, is used, the graphics block is created in
  3153.             memory retrievable by GETLASTSTRING, but no text is actually
  3154.             drawn on the screen.  (Note: the system font is automatically
  3155.             installed when WHICHVGA is called.)  The text is drawn upside
  3156.             down with X, Y specifying the lower, right corner.  This
  3157.             corner corresponds to the upper, left corner when the text is
  3158.             oriented upright.
  3159.  
  3160.             SEE ALSO
  3161.  
  3162.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGLT,
  3163.             DRWSTRINGRT, GETLASTSTRING
  3164.  
  3165.             EXAMPLE
  3166.  
  3167.             REM DRAWS SOME UP-SIDE-DOWN TEXT AT THE CENTER OF THE SCREEN
  3168.             $LINK "SVGAPB.PBL"
  3169.             $INCLUDE "SVGAPB.BI"
  3170.             DEFINT A-Z
  3171.  
  3172.             VMODE=VIDEOMODEGET
  3173.             IF WHICHVGA = 0 THEN STOP
  3174.             DUMMY=RES640
  3175.             A$ = "HELLO WORLD"
  3176.             DRWSTRINGDN 1, 10, 0, A$, 320, 240
  3177.             WHILE INKEY$ = ""
  3178.             WEND
  3179.             VIDEOMODESET VMODE
  3180.             END
  3181.  
  3182.  
  3183.                                                                          50
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.           DRWSTRINGLT
  3190.  
  3191.             PROTOTYPE
  3192.  
  3193.             SUB DRWSTRINGLT (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  3194.  
  3195.             INPUT
  3196.  
  3197.             Mode - pixel write mode (no action=0, SET=1, XOR=2, OR=3,
  3198.             AND=4)
  3199.             FColor - foreground index to color in current palette
  3200.             BColor - background index to color in current palette
  3201.             Strng$ - string of ASCII characters to be drawn
  3202.             X, Y - location of lower, left corner of block
  3203.  
  3204.             OUTPUT
  3205.  
  3206.             no value returned
  3207.  
  3208.             USAGE
  3209.  
  3210.             DRWSTRINGLT takes the ASCII characters contained in Strng$ and
  3211.             creates a graphics block similar to the blocks used by Blkget
  3212.             and Blkput.  The characters are drawn with color FColor using
  3213.             the current font and the background is color BColor.  When
  3214.             mode 0, no action, is used, the graphics block is created in
  3215.             memory retrievable by GETLASTSTRING, but no text is actually
  3216.             drawn on the screen.  (Note: the system font is automatically
  3217.             installed when WHICHVGA is called.)  The text block is rotated
  3218.             90 to the left with X, Y specifying the lower, left corner.
  3219.             This corner corresponds to the upper, left corner when the
  3220.             text is oriented upright.
  3221.  
  3222.  
  3223.             SEE ALSO
  3224.  
  3225.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3226.             DRWSTRINGRT, GETLASTSTRING
  3227.  
  3228.             EXAMPLE
  3229.  
  3230.             REM DRAWS SOME TEXT ROTATED BY 90 DEGREES TO THE LEFT AT THE
  3231.             REM CENTER OF THE SCREEN
  3232.             $LINK "SVGAPB.PBL"
  3233.             $INCLUDE "SVGAPB.BI"
  3234.             DEFINT A-Z
  3235.  
  3236.             VMODE=VIDEOMODEGET
  3237.             IF WHICHVGA = 0 THEN STOP
  3238.             DUMMY=RES640
  3239.             A$ = "HELLO WORLD"
  3240.             DRWSTRINGLT 1, 10, 0, A$, 320, 240
  3241.             WHILE INKEY$ = ""
  3242.             WEND
  3243.  
  3244.  
  3245.                                                                          51
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.             VIDEOMODESET VMODE
  3252.             END
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.                                                                          52
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.           DRWSTRINGRT
  3314.  
  3315.             PROTOTYPE
  3316.  
  3317.             SUB DRWSTRINGRT (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  3318.  
  3319.             INPUT
  3320.  
  3321.             Mode - pixel write mode (no action=0, SET=1, XOR=2, OR=3,
  3322.             AND=4)
  3323.             FColor - foreground index to color in current palette
  3324.             BColor - background index to color in current palette
  3325.             Strng$ - string of ASCII characters to be drawn
  3326.             X, Y - location of upper, right corner of block
  3327.  
  3328.             OUTPUT
  3329.  
  3330.             no value returned
  3331.  
  3332.             USAGE
  3333.  
  3334.             DRWSTRINGRT takes the ASCII characters contained in Strng$ and
  3335.             creates a graphics block similar to the blocks used by Blkget
  3336.             and Blkput.  The characters are drawn with color FColor using
  3337.             the current font and the background is color BColor.  When
  3338.             mode 0, no action, is used, the graphics block is created in
  3339.             memory retrievable by GETLASTSTRING, but no text is actually
  3340.             drawn on the screen.  (Note: the system font is automatically
  3341.             installed when WHICHVGA is called.)  The text block is rotated
  3342.             90 to the right with X, Y specifying the upper, right corner.
  3343.             This corner corresponds to the upper, left corner if the text
  3344.             is oriented upright.
  3345.  
  3346.  
  3347.             SEE ALSO
  3348.  
  3349.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3350.             DRWSTRINGLT, GETLASTSTRING
  3351.  
  3352.             EXAMPLE
  3353.  
  3354.             REM DRAWS SOME TEXT ROTATED BY 90 DEGREES TO THE RIGHT AT THE
  3355.             REM CENTER OF THE SCREEN
  3356.             $LINK "SVGAPB.PBL"
  3357.             $INCLUDE "SVGAPB.BI"
  3358.             DEFINT A-Z
  3359.  
  3360.             VMODE=VIDEOMODEGET
  3361.             IF WHICHVGA = 0 THEN STOP
  3362.             DUMMY=RES640
  3363.             A$ = "HELLO WORLD"
  3364.             DRWSTRINGRT 1, 10, 0, A$, 320, 240
  3365.             WHILE INKEY$ = ""
  3366.             WEND
  3367.  
  3368.  
  3369.                                                                          53
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.             VIDEOMODESET VMODE
  3376.             END
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.                                                                          54
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.           FILLAREA
  3438.  
  3439.             PROTOTYPE
  3440.  
  3441.             SUB FILLAREA (XSeed%, YSeed%, BorderColor%, FillColor%)
  3442.  
  3443.             INPUT
  3444.  
  3445.             XSeed, YSeed - seed location to start fill
  3446.             BorderColor - index to color in current palette at which
  3447.             filling stops
  3448.             FillColor - index to color in current palette to fill within
  3449.             the border
  3450.  
  3451.             OUTPUT
  3452.  
  3453.             no value returned
  3454.  
  3455.             USAGE
  3456.  
  3457.             FILLAREA fills a region with a new color specified by
  3458.             FillColor.  The region is defined by any line or curve of the
  3459.             color BorderColor or by the edge of the viewport.  All
  3460.             graphics within the region are lost and covered with the
  3461.             FillColor.  The border is not effected.
  3462.  
  3463.             SEE ALSO
  3464.  
  3465.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLCOLOR,
  3466.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  3467.             SETVIEW
  3468.  
  3469.             EXAMPLE
  3470.  
  3471.             REM FILLS A BOX WITH A COLOR
  3472.             $LINK "SVGAPB.PBL"
  3473.             $INCLUDE "SVGAPB.BI"
  3474.             DEFINT A-Z
  3475.  
  3476.             VMODE=VIDEOMODEGET
  3477.             IF WHICHVGA = 0 THEN STOP
  3478.             DUMMY=RES640
  3479.             DRWBOX 1, 10, 0, 0, 100, 100
  3480.             FILLAREA 1, 1, 10, 7
  3481.             WHILE INKEY$ = ""
  3482.             WEND
  3483.             VIDEOMODESET VMODE
  3484.             END
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.                                                                          55
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.           FILLCOLOR
  3500.  
  3501.             PROTOTYPE
  3502.  
  3503.             SUB FILLCOLOR (XSeed%, YSeed%, OldColor%, NewColor%)
  3504.  
  3505.             INPUT
  3506.  
  3507.             XSeed, YSeed - seed location to start fill
  3508.             OldColor - index to color in current palette to change
  3509.             NewColor - index to color in current palette to replace
  3510.             OldColor
  3511.  
  3512.             OUTPUT
  3513.  
  3514.             no value returned
  3515.  
  3516.             USAGE
  3517.  
  3518.             FILLCOLOR replaces every existence of OldColor with NewColor
  3519.             within a region.  The region is defined as any pixel of
  3520.             OldColor which has a path of pixels of OldColor or NewColor
  3521.             with sides touching back to the seed point, (XSeed, YSeed).
  3522.             Therefore, only pixels of OldColor are modified and no other
  3523.             information is changed.
  3524.  
  3525.             SEE ALSO
  3526.  
  3527.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3528.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  3529.             SETVIEW
  3530.  
  3531.             EXAMPLE
  3532.  
  3533.             REM REPLACES THE BLACK COLOR WITH A NEW COLOR
  3534.             $LINK "SVGAPB.PBL"
  3535.             $INCLUDE "SVGAPB.BI"
  3536.             DEFINT A-Z
  3537.  
  3538.             VMODE=VIDEOMODEGET
  3539.             IF WHICHVGA = 0 THEN STOP
  3540.             DUMMY=RES640
  3541.             DRWBOX 1, 10, 0, 0, 100, 100
  3542.             DRWBOX 1, 12, 20, 20, 80, 80
  3543.             FILLCOLOR 1, 1, 0, 7
  3544.             WHILE INKEY$ = ""
  3545.             WEND
  3546.             VIDEOMODESET VMODE
  3547.             END
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.                                                                          56
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.           FILLCONVEXPOLY
  3562.  
  3563.             PROTOTYPE
  3564.  
  3565.             SUB FILLCONVEXPOLY (PolyColor%, NumPoints%, PointArray%)
  3566.  
  3567.             INPUT
  3568.  
  3569.             PolyColor - index to color in current palette
  3570.             NumPoints - number of points in PointArray
  3571.             PointArray - P2DType array holding points of polygon
  3572.  
  3573.             OUTPUT
  3574.  
  3575.             no value returned
  3576.  
  3577.             USAGE
  3578.  
  3579.             FILLCONVEXPOLY draws a solid polygon outlined by the points
  3580.             given in PointArray.  The points are expected to be
  3581.             consecutive and the resulting polygon should be convex (ie.
  3582.             the polygon should not curve in on itself like a kidney bean).
  3583.             The function also assumes that the last point in the array
  3584.             connects to the first.
  3585.  
  3586.             SEE ALSO
  3587.  
  3588.             D3PROJECT, DRWFILLBOX, FILLAREA, FILLCOLOR, FILLPAGE,
  3589.             FILLPOLY, FILLSCREEN, FILLVIEW
  3590.  
  3591.             EXAMPLE
  3592.  
  3593.             REM SHOW FILLCONVEXPOLY
  3594.             $INCLUDE "SVGAPB.BI"
  3595.             $LINK "SVGAPB.PBL"
  3596.             DEFINT A-Z
  3597.             DIM T(0 TO 20) AS P2DType
  3598.  
  3599.             VGA = WHICHVGA
  3600.             DUMMY = RES640
  3601.  
  3602.             FOR I = 0 TO 99
  3603.                T(0).X = RND * GETMAXX
  3604.                T(0).Y = RND * GETMAXY
  3605.                T(1).X = RND * GETMAXX
  3606.                T(1).Y = RND * GETMAXY
  3607.                T(2).X = RND * GETMAXX
  3608.                T(2).Y = RND * GETMAXY
  3609.                C = RND * 15
  3610.                FILLCONVEXPOLY C, 3, T(0).X
  3611.             NEXT I
  3612.  
  3613.             WHILE INKEY$ = ""
  3614.             WEND
  3615.  
  3616.  
  3617.                                                                          57
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.             DUMMY = RESTEXT
  3625.             END
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.                                                                          58
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.           FILLPAGE
  3686.  
  3687.             PROTOTYPE
  3688.  
  3689.             SUB FILLPAGE (Color%)
  3690.  
  3691.             INPUT
  3692.  
  3693.             Color - index to color in current palette
  3694.  
  3695.             OUTPUT
  3696.  
  3697.             no value returned
  3698.  
  3699.             USAGE
  3700.  
  3701.             FILLPAGE clears the currently active page with the specified
  3702.             color.  All information on the page is lost.  (Note, a faster
  3703.             method to clear the page is to call any of the 'RES###'
  3704.             functions.  These reset the graphics screen and automatically
  3705.             clear it to color index zero as well as reset the default
  3706.             palette.)
  3707.  
  3708.             SEE ALSO
  3709.  
  3710.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3711.             FILLCOLOR, FILLCONVEXPOLY, FILLPOLY, FILLSCREEN, FILLVIEW
  3712.  
  3713.             EXAMPLE
  3714.  
  3715.             REM FILLS THE CURRENT VIDEO PAGE WITH A COLOR
  3716.             $LINK "SVGAPB.PBL"
  3717.             $INCLUDE "SVGAPB.BI"
  3718.             DEFINT A-Z
  3719.  
  3720.             VMODE=VIDEOMODEGET
  3721.             IF WHICHVGA = 0 THEN STOP
  3722.             DUMMY=RES640
  3723.             DUMMY=PAGEACTIVE(0)
  3724.             FILLPAGE 10
  3725.             WHILE INKEY$ = ""
  3726.             WEND
  3727.             VIDEOMODESET VMODE
  3728.             END
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.                                                                          59
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.           FILLPOLY
  3748.  
  3749.             PROTOTYPE
  3750.  
  3751.             SUB FILLPOLY (PolyColor%, NumPoints%, PointArray%)
  3752.  
  3753.             INPUT
  3754.  
  3755.             PolyColor - index to color in current palette
  3756.             NumPoints - number of points in PointArray
  3757.             PointArray - P2DType array holding points of polygon
  3758.  
  3759.             OUTPUT
  3760.  
  3761.             no value returned
  3762.  
  3763.             USAGE
  3764.  
  3765.             FILLPOLY draws a solid polygon outlined by the points given in
  3766.             PointArray.  The points are expected to be consecutive.
  3767.             However, there are no restrictions on the relative locations
  3768.             of the points.  The polygon may curve in on itself or have
  3769.             crossed lines.  The function also assumes that the last point
  3770.             in the array connects to the first.  FILLPOLY can be used
  3771.             interchangeably with FILLCONVEXPOLY, although FILLPOLY is
  3772.             slightly slower.
  3773.  
  3774.             Special thanks to Eric Jorgensen for providing the algorithm
  3775.             which formed the basis for FILLPOLY.
  3776.  
  3777.             SEE ALSO
  3778.  
  3779.             D3PROJECT, DRWFILLBOX, FILLAREA, FILLCOLOR, FILLCONVEXPOLY,
  3780.             FILLPAGE, FILLSCREEN, FILLVIEW
  3781.  
  3782.             EXAMPLE
  3783.  
  3784.             REM SHOW FILLPOLY
  3785.             $LINK "SVGAPB.PBL"
  3786.             $INCLUDE "SVGAPB.BI"
  3787.  
  3788.             DEFINT A-Z
  3789.  
  3790.             DIM P(4) AS P2DType
  3791.  
  3792.             IF WHICHCPU < 386 THEN END
  3793.             IF WHICHVGA = 0 THEN END
  3794.             IF RES640 <> 1 THEN
  3795.                DUMMY = RESTEXT
  3796.                END
  3797.             END IF
  3798.  
  3799.             P(0).X = 320
  3800.             P(0).Y = 40
  3801.  
  3802.  
  3803.                                                                          60
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.             P(1).X = 203
  3811.             P(1).Y = 401
  3812.  
  3813.             P(2).X = 510
  3814.             P(2).Y = 179
  3815.  
  3816.             P(3).X = 130
  3817.             P(3).Y = 179
  3818.  
  3819.             P(4).X = 437
  3820.             P(4).Y = 401
  3821.  
  3822.             FILLPOLY 10, 5, P(0).X
  3823.  
  3824.             WHILE INKEY$ = ""
  3825.             WEND
  3826.             DUMMY = RESTEXT
  3827.             CLS
  3828.             END
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.  
  3847.  
  3848.  
  3849.  
  3850.  
  3851.  
  3852.  
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.                                                                          61
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.           FILLSCREEN
  3872.  
  3873.             PROTOTYPE
  3874.  
  3875.             SUB FILLSCREEN (Color%)
  3876.  
  3877.             INPUT
  3878.  
  3879.             Color - index to color in current palette
  3880.  
  3881.             OUTPUT
  3882.  
  3883.             no value returned
  3884.  
  3885.             USAGE
  3886.  
  3887.             FILLSCREEN clears the entire screen with the specified color.
  3888.             All information on the screen is lost.  (Note, a faster method
  3889.             to clear the screen is to call any of the 'RES###' functions.
  3890.             These reset the graphics screen and automatically clear it to
  3891.             color index zero as well as reset the default palette.)
  3892.  
  3893.             SEE ALSO
  3894.  
  3895.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3896.             FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLVIEW
  3897.  
  3898.             EXAMPLE
  3899.  
  3900.             REM FILLS THE SCREEN WITH A COLOR
  3901.             $LINK "SVGAPB.PBL"
  3902.             $INCLUDE "SVGAPB.BI"
  3903.             DEFINT A-Z
  3904.  
  3905.             VMODE=VIDEOMODEGET
  3906.             IF WHICHVGA = 0 THEN STOP
  3907.             DUMMY=RES640
  3908.             FILLSCREEN 10
  3909.             WHILE INKEY$ = ""
  3910.             WEND
  3911.             VIDEOMODESET VMODE
  3912.             END
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.                                                                          62
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.           FILLVIEW
  3934.  
  3935.             PROTOTYPE
  3936.  
  3937.             SUB FILLVIEW (Color%)
  3938.  
  3939.             INPUT
  3940.  
  3941.             Color - index to color in current palette
  3942.  
  3943.             OUTPUT
  3944.  
  3945.             no value returned
  3946.  
  3947.             USAGE
  3948.  
  3949.             FILLVIEW fills the currently defined viewport with the
  3950.             specified color.  All information in the viewport is lost.
  3951.  
  3952.             SEE ALSO
  3953.  
  3954.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3955.             FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN,
  3956.             SETVIEW
  3957.  
  3958.             EXAMPLE
  3959.  
  3960.             REM FILLS THE VIEWPORT WITH A COLOR
  3961.             $LINK "SVGAPB.PBL"
  3962.             $INCLUDE "SVGAPB.BI"
  3963.             DEFINT A-Z
  3964.  
  3965.             VMODE=VIDEOMODEGET
  3966.             IF WHICHVGA = 0 THEN STOP
  3967.             DUMMY=RES640
  3968.             SETVIEW 100, 100, 539, 379
  3969.             FILLVIEW 10
  3970.             WHILE INKEY$ = ""
  3971.             WEND
  3972.             VIDEOMODESET VMODE
  3973.             END
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.                                                                          63
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.           FONTGETINFO
  3996.  
  3997.             PROTOTYPE
  3998.  
  3999.             SUB FONTGETINFO (Width%, Height%)
  4000.  
  4001.             INPUT
  4002.  
  4003.             no input parameters
  4004.  
  4005.             OUTPUT
  4006.  
  4007.             no value returned
  4008.             Width - width in pixels of current font
  4009.             Height - height in pixels of current font
  4010.  
  4011.             USAGE
  4012.  
  4013.             FONTGETINFO returns in Width and Height the dimensions of the
  4014.             currently loaded font.
  4015.  
  4016.             SEE ALSO
  4017.  
  4018.             FONTSET, FONTSYSTEM
  4019.  
  4020.             EXAMPLE
  4021.  
  4022.             REM GET INFO ON THE SYSTEM FONT
  4023.             $LINK "SVGAPB.PBL"
  4024.             $INCLUDE "SVGAPB.BI"
  4025.             DEFINT A-Z
  4026.  
  4027.             VMODE=VIDEOMODEGET
  4028.             IF WHICHVGA = 0 THEN STOP
  4029.             DUMMY=RES640
  4030.             FONTGETINFO WDTH, HGTH
  4031.             A$ = "SYSTEM FONT WIDTH =" + STR$(WDTH)
  4032.             B$ = "SYSTEM FONT HEIGHT =" + STR$(HGTH)
  4033.             DRWSTRING 1, 7, 0, A$, 0, 0
  4034.             DRWSTRING 1, 7, 0, B$, 0, 20
  4035.             WHILE INKEY$ = ""
  4036.             WEND
  4037.             VIDEOMODESET VMODE
  4038.             END
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.                                                                          64
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.           FONTSET
  4058.  
  4059.             PROTOTYPE
  4060.  
  4061.             SUB FONTSET (Font?)
  4062.  
  4063.             INPUT
  4064.  
  4065.             Font - byte array with 4098 elements containing font data
  4066.  
  4067.             OUTPUT
  4068.  
  4069.             no value returned
  4070.  
  4071.             USAGE
  4072.  
  4073.             FONTSET loads the current font with the data in Font.  The
  4074.             byte array must have at least 4098 members.  The first byte of
  4075.             Font holds the font width (1 to 8) and the second byte holds
  4076.             the font height (1 to 16).  The remaining 4096 bytes are the
  4077.             character raster data, 16 bytes per character.
  4078.  
  4079.             SEE ALSO
  4080.  
  4081.             FONTGETINFO, FONTSYSTEM
  4082.  
  4083.             EXAMPLE
  4084.  
  4085.             See FONTSYSTEM
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.                                                                          65
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.           FONTSYSTEM
  4120.  
  4121.             PROTOTYPE
  4122.  
  4123.             SUB FONTSYSTEM ()
  4124.  
  4125.             INPUT
  4126.  
  4127.             no input parameters
  4128.  
  4129.             OUTPUT
  4130.  
  4131.             no value returned
  4132.  
  4133.             USAGE
  4134.  
  4135.             FONTSYSTEM sets the current font to the standard system font.
  4136.             This font is automatically set when WHICHVGA is called.
  4137.  
  4138.             SEE ALSO
  4139.  
  4140.             WHICHVGA, FONTGETINFO, FONTSET
  4141.  
  4142.             EXAMPLE
  4143.  
  4144.             REM LOAD A FONT FROM DISK AND ENABLE IT
  4145.             REM THEN GO BACK TO THE SYSTEM FONT
  4146.             $LINK "SVGAPB.PBL"
  4147.             $INCLUDE "SVGAPB.BI"
  4148.             DEFINT A-Z
  4149.  
  4150.             DIM NEWFONT(4097) AS BYTE
  4151.  
  4152.             VMODE = VIDEOMODEGET
  4153.             IF WHICHVGA = 0 THEN STOP
  4154.             DUMMY=RES640
  4155.             OPEN "DRAGON.FNT" FOR BINARY AS #1
  4156.             FOR I = 0 TO 4097
  4157.                GET #1, , NEWFONT(I)
  4158.             NEXT I
  4159.             CLOSE #1
  4160.             FONTSET NEWFONT(0)
  4161.             DRWSTRING 1, 7, 0, "The Dragon Font!", 0, 0
  4162.             FONTSYSTEM
  4163.             DRWSTRING 1, 7, 0, "The System Font!", 0, 20
  4164.             WHILE INKEY$ = ""
  4165.             WEND
  4166.             VIDEOMODESET VMODE
  4167.             END
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.                                                                          66
  4176.  
  4177.  
  4178.  
  4179.  
  4180.  
  4181.           GETARCCOS
  4182.  
  4183.             PROTOTYPE
  4184.  
  4185.             FUNCTION GETARCCOS% (Value&)
  4186.  
  4187.             INPUT
  4188.  
  4189.             Value - number between -1 and +1 scaled up by 13 bits (8192)
  4190.  
  4191.             OUTPUT
  4192.  
  4193.             GETARCCOS returns the arc cosine of Value in degrees.
  4194.  
  4195.             USAGE
  4196.  
  4197.             GETARCCOS returns the arc cosine in degrees for the given
  4198.             value.  The return will be between 0 and 180 degrees.  Value
  4199.             should be between -8192 and +8192 representing the range -1 to
  4200.             +1.  Input values outside this range are invalid and GETARCCOS
  4201.             will return -32768. Floating point values are ignored.  This
  4202.             function uses an integer lookup table stored within the
  4203.             library in order to produce the fastest possible results.  No
  4204.             floating point arithmetic is used.  The scale factor of 13
  4205.             bits (8192) was chosen because this is the number of bits at
  4206.             which every change of one degree gives a change in the value
  4207.             of the sine (or cosine) function.
  4208.  
  4209.             SEE ALSO
  4210.  
  4211.             GETARCSIN, GETARCTAN, GETCOS, GETSIN, GETTAN
  4212.  
  4213.             EXAMPLE
  4214.  
  4215.             REM SHOW GETARCCOS
  4216.             $LINK "SVGAPB.PBL"
  4217.             $INCLUDE "SVGAPB.BI"
  4218.             DEFINT A-Z
  4219.  
  4220.             VMODE = VIDEOMODEGET
  4221.             IF WHICHVGA = 0 THEN STOP
  4222.             DUMMY=RES640
  4223.             DRWBOX 1, 10, 0, 0, 639, 479
  4224.             DRWLINE 1, 10, 0, 240, 639, 240
  4225.             DRWLINE 1, 10, 320, 0, 320, 479
  4226.             DEG2RAD! = 4 * ATN(1) / 180
  4227.             FOR I = -8192 TO 8192 STEP 16
  4228.                Y1& = GETARCCOS(I)
  4229.                DRWPOINT 1, 12, 320 + Y1& * 3, 240 - I / 34
  4230.             NEXT I
  4231.             WHILE INKEY$ = ""
  4232.             WEND
  4233.             VIDEOMODESET VMODE
  4234.             END
  4235.  
  4236.  
  4237.                                                                          67
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.           GETARCSIN
  4244.  
  4245.             PROTOTYPE
  4246.  
  4247.             FUNCTION GETARCSIN% (Value&)
  4248.  
  4249.             INPUT
  4250.  
  4251.             Value - number between -1 and +1 scaled up by 13 bits (8192)
  4252.  
  4253.             OUTPUT
  4254.  
  4255.             GETARCSIN returns the arc sine of Value in degrees.
  4256.  
  4257.             USAGE
  4258.  
  4259.             GETARCSIN returns the arc sine in degrees for the given value.
  4260.             The return will be between -90 and +90 degrees.  Value should
  4261.             be between -8192 and +8192 representing the range -1 to +1.
  4262.             Input values outside this range are invalid and GETARCSIN will
  4263.             return -32768. Floating point values are ignored.  This
  4264.             function uses an integer lookup table stored within the
  4265.             library in order to produce the fastest possible results.  No
  4266.             floating point arithmetic is used.  The scale factor of 13
  4267.             bits (8192) was chosen because this is the number of bits at
  4268.             which every change of one degree gives a change in the value
  4269.             of the sine (or cosine) function.
  4270.  
  4271.             SEE ALSO
  4272.  
  4273.             GETARCCOS, GETARCTAN, GETCOS, GETSIN, GETTAN
  4274.  
  4275.             EXAMPLE
  4276.  
  4277.             REM SHOW GETARCSIN
  4278.             $LINK "SVGAPB.PBL"
  4279.             $INCLUDE "SVGAPB.BI"
  4280.             DEFINT A-Z
  4281.  
  4282.             VMODE = VIDEOMODEGET
  4283.             IF WHICHVGA = 0 THEN STOP
  4284.             DUMMY=RES640
  4285.             DRWBOX 1, 10, 0, 0, 639, 479
  4286.             DRWLINE 1, 10, 0, 240, 639, 240
  4287.             DRWLINE 1, 10, 320, 0, 320, 479
  4288.             DEG2RAD! = 4 * ATN(1) / 180
  4289.             FOR I = -8192 TO 8192 STEP 16
  4290.                Y1& = GETARCSIN(I)
  4291.                DRWPOINT 1, 12, 320 + Y1& * 3, 240 - I / 34
  4292.             NEXT I
  4293.             WHILE INKEY$ = ""
  4294.             WEND
  4295.             VIDEOMODESET VMODE
  4296.             END
  4297.  
  4298.  
  4299.                                                                          68
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.           GETARCTAN
  4306.  
  4307.             PROTOTYPE
  4308.  
  4309.             FUNCTION GETARCTAN% (Value&)
  4310.  
  4311.             INPUT
  4312.  
  4313.             Value - long integer representing a decimal scaled up by 13
  4314.             bits (8192)
  4315.  
  4316.             OUTPUT
  4317.  
  4318.             GETARCTAN returns the arc tangent of Value in degrees.
  4319.  
  4320.             USAGE
  4321.  
  4322.             GETARCTAN returns the arc cosine in degrees for the given
  4323.             value.  The return will be between -89 and +89 degrees.  Value
  4324.             can be any long integer.  It is interpreted as a decimal
  4325.             scaled up by 8192 (13 bits). Floating point values are
  4326.             ignored.  This function uses an integer lookup table stored
  4327.             within the library in order to produce the fastest possible
  4328.             results.  No floating point arithmetic is used.  The scale
  4329.             factor of 13 bits (8192) was chosen because this is the number
  4330.             of bits at which every change of one degree gives a change in
  4331.             the value of the sine (or cosine) function.
  4332.  
  4333.             SEE ALSO
  4334.  
  4335.             GETARCCOS, GETARCSIN, GETCOS, GETSIN, GETTAN
  4336.  
  4337.             EXAMPLE
  4338.  
  4339.             REM SHOW GETARCTAN
  4340.             $LINK "SVGAPB.PBL"
  4341.             $INCLUDE "SVGAPB.BI"
  4342.             DEFINT A-Z
  4343.  
  4344.             VMODE = VIDEOMODEGET
  4345.             IF WHICHVGA = 0 THEN STOP
  4346.             DUMMY=RES640
  4347.             DRWBOX 1, 10, 0, 0, 639, 479
  4348.             DRWLINE 1, 10, 0, 240, 639, 240
  4349.             DRWLINE 1, 10, 320, 0, 320, 479
  4350.             DEG2RAD! = 4 * ATN(1) / 180
  4351.             FOR I = -8192 TO 8192 STEP 16
  4352.                Y1& = GETARCTAN(I)
  4353.                Y2& = ATN(I / 8192) / DEG2RAD!
  4354.                DRWPOINT 1, 12, 320 + Y1& * 6, 240 - I / 34
  4355.                DRWPOINT 1, 15, 320 + Y2& * 6, 240 - I / 34
  4356.             NEXT I
  4357.             WHILE INKEY$ = ""
  4358.             WEND
  4359.  
  4360.  
  4361.                                                                          69
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.             VIDEOMODESET VMODE
  4368.             END
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.                                                                          70
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.           GETCOS
  4430.  
  4431.             PROTOTYPE
  4432.  
  4433.             FUNCTION GETCOS& (Angle&)
  4434.  
  4435.             INPUT
  4436.  
  4437.             Angle - angle in degrees
  4438.  
  4439.             OUTPUT
  4440.  
  4441.             GETCOS returns the cosine of Angle scaled up by 13 bits
  4442.             (8192).
  4443.  
  4444.             USAGE
  4445.  
  4446.             GETCOS returns the cosine of the specified angle.  Angle can
  4447.             be any long value; floating point values are ignored.  The
  4448.             return value has been multiplied by 8192.  This function uses
  4449.             an integer lookup table stored within the library in order to
  4450.             produce the fastest possible results.  No floating point
  4451.             arithmetic is used.  The scale factor of 13 bits (8192) was
  4452.             chosen because this is the number of bits at which every
  4453.             change of one degree gives a change in the value of the sine
  4454.             (or cosine) function.
  4455.  
  4456.             SEE ALSO
  4457.  
  4458.             GETARCCOS, GETARCSIN, GETARCTAN, GETSIN, GETTAN
  4459.  
  4460.             EXAMPLE
  4461.  
  4462.             REM SHOW GETCOS
  4463.             $LINK "SVGAPB.PBL"
  4464.             $INCLUDE "SVGAPB.BI"
  4465.             DEFINT A-Z
  4466.  
  4467.             VMODE = VIDEOMODEGET
  4468.             IF WHICHVGA = 0 THEN STOP
  4469.             DUMMY=RES640
  4470.             DRWBOX 1, 10, 0, 0, 639, 479
  4471.             DRWLINE 1, 10, 0, 240, 639, 240
  4472.             DRWLINE 1, 10, 320, 0, 320, 479
  4473.             DEG2RAD! = 4 * ATN(1) / 180
  4474.             FOR I = -360 TO 360
  4475.                Y1& = GETCOS(I)
  4476.                Y1& = Y1& * 240 / 8192
  4477.                Y2& = 240 * COS(I * DEG2RAD!)
  4478.                DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4479.                DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4480.             NEXT I
  4481.             WHILE INKEY$ = ""
  4482.             WEND
  4483.  
  4484.  
  4485.                                                                          71
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.             VIDEOMODESET VMODE
  4492.             END
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.  
  4515.  
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.                                                                          72
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.           GETLASTSTRING
  4554.  
  4555.             PROTOTYPE
  4556.  
  4557.             SUB GETLASTSTRING (StrngGfxBlk%)
  4558.  
  4559.             INPUT
  4560.  
  4561.             no input parameters
  4562.  
  4563.             OUTPUT
  4564.  
  4565.             no value returned
  4566.             GfxBlk - integer destination array holding bitmap of text
  4567.             block
  4568.  
  4569.             USAGE
  4570.  
  4571.             GETLASTSTRING returns the text drawn on the screen by the last
  4572.             called DRWSTRING function.  The text is returned in GfxBlk
  4573.             which may be used with BLKPUT or the sprite functions.  The
  4574.             text in GfxBlk is oriented in the same manner as the last
  4575.             called DRWSTRING function.  The intended use is to call the
  4576.             DRWSTRING function using mode 0 which does not actually draw
  4577.             text on the screen.  GETLASTSTRING should be called
  4578.             immediately after the DRWSTRING function to prevent possible
  4579.             loss of data caused by other functions.
  4580.  
  4581.             GfxBlk must be dimensioned as a short integer array with a
  4582.             size in integers equal to
  4583.  
  4584.                     [(fontwidth*stringlength)*(fontheight)] / 2+3.
  4585.  
  4586.             The font's dimensions can be obtained by calling FONTGETINFO
  4587.             and the string's length can be obtained using Basic's LEN
  4588.             function.  Note, however, that GfxBlk can be quite large.  If
  4589.             the size of GfxBlk is insufficient, GETLASTSTRING will
  4590.             overwrite any data in memory contained beyond GfxBlk and may
  4591.             possibly cause the system to crash.
  4592.  
  4593.             Arrays should be passed by giving the element within the array
  4594.             from where the action should take place.  This allows the
  4595.             programmer to store more than one item within the same array
  4596.             or act on only a portion of the array.
  4597.  
  4598.             SEE ALSO
  4599.  
  4600.             BLKPUT, DRWSTRING, DRWSTRINGDN, DRWSTRINGLT, DRWSTRINGRT,
  4601.             FONTGETINFO
  4602.  
  4603.             EXAMPLE
  4604.  
  4605.             REM USES GETLASTSTRING TO DRAW SOME TEXT AT THE CENTER OF THE
  4606.             SCREEN
  4607.  
  4608.  
  4609.                                                                          73
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.             $LINK "SVGAPB.PBL"
  4616.             $INCLUDE "SVGAPB.BI"
  4617.             DEFINT A-Z
  4618.  
  4619.             VMODE=VIDEOMODEGET
  4620.             IF WHICHVGA = 0 THEN STOP
  4621.             DUMMY=RES640
  4622.             A$ = "HELLO WORLD"
  4623.             DRWSTRING 0, 10, 0, A$, 0, 0
  4624.             FONTGETINFO W, H
  4625.             L = LEN(A$)
  4626.             BLKSIZE = ( (W*L)*H )\2 + 3
  4627.             DIM BLK(0 TO BLKSIZE)
  4628.             GETLASTSTRING BLK(0)
  4629.             BLKPUT 1, 320, 240, BLK(0)
  4630.             WHILE INKEY$ = ""
  4631.             WEND
  4632.             VIDEOMODESET VMODE
  4633.             END
  4634.  
  4635.  
  4636.  
  4637.  
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.                                                                          74
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.           GETMAXX
  4678.  
  4679.             PROTOTYPE
  4680.  
  4681.             FUNCTION GETMAXX% ()
  4682.  
  4683.             INPUT
  4684.  
  4685.             no input parameters
  4686.  
  4687.             OUTPUT
  4688.  
  4689.             GETMAXX returns the current horizontal resolution of the
  4690.             screen.
  4691.  
  4692.             USAGE
  4693.  
  4694.             GETMAXX returns the horizontal resolution of the screen in the
  4695.             current mode.  This function should only be called if one of
  4696.             the RES### functions has been previously called.  Otherwise,
  4697.             the value returned is meaningless.
  4698.  
  4699.             SEE ALSO
  4700.  
  4701.             GETMAXY
  4702.  
  4703.             EXAMPLE
  4704.  
  4705.             REM SHOW GETMAXX
  4706.             $LINK "SVGAPB.PBL"
  4707.             $INCLUDE "SVGAPB.BI"
  4708.             DEFINT A-Z
  4709.  
  4710.             VMODE = VIDEOMODEGET
  4711.             IF WHICHVGA = 0 THEN STOP
  4712.             DUMMY=RES640
  4713.             X$ = "MAX X SCREEN VALUE IS:" + STR$(GETMAXX)
  4714.             DRWSTRING 1, 7, 0, X$, 0, 0
  4715.             SETVIEW 0, 0, 400, 479
  4716.             X$ = "MAX X SCREEN VALUE IS STILL:" + STR$(GETMAXX)
  4717.             DRWSTRING 1, 7, 0, X$, 0, 20
  4718.             WHILE INKEY$ = ""
  4719.             WEND
  4720.             VIDEOMODESET VMODE
  4721.             END
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.                                                                          75
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.           GETMAXY
  4740.  
  4741.             PROTOTYPE
  4742.  
  4743.             FUNCTION GETMAXY% ()
  4744.  
  4745.             INPUT
  4746.  
  4747.             no input parameters
  4748.  
  4749.             OUTPUT
  4750.  
  4751.             GETMAXY returns the current vertical resolution of the screen.
  4752.  
  4753.             USAGE
  4754.  
  4755.             GETMAXY returns the vertical resolution of the screen in the
  4756.             current mode.  This function should only be called if one of
  4757.             the RES### functions has been previously called.  Otherwise,
  4758.             the value returned is meaningless.
  4759.  
  4760.             SEE ALSO
  4761.  
  4762.             GETMAXX
  4763.  
  4764.             EXAMPLE
  4765.  
  4766.             REM SHOW GETMAXY
  4767.             $LINK "SVGAPB.PBL"
  4768.             $INCLUDE "SVGAPB.BI"
  4769.             DEFINT A-Z
  4770.  
  4771.             VMODE = VIDEOMODEGET
  4772.             IF WHICHVGA = 0 THEN STOP
  4773.             DUMMY=RES640
  4774.             Y$ = "MAX Y SCREEN VALUE IS:" + STR$(GETMAXY)
  4775.             DRWSTRING 1, 7, 0, Y$, 0, 0
  4776.             SETVIEW 0, 0, 639, 200
  4777.             Y$ = "MAX Y SCREEN VALUE IS STILL:" + STR$(GETMAXY)
  4778.             DRWSTRING 1, 7, 0, Y$, 0, 20
  4779.             WHILE INKEY$ = ""
  4780.             WEND
  4781.             VIDEOMODESET VMODE
  4782.             END
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.                                                                          76
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.           GETPOINT
  4802.  
  4803.             PROTOTYPE
  4804.  
  4805.             FUNCTION GETPOINT% (X%, Y%)
  4806.  
  4807.             INPUT
  4808.  
  4809.             X, Y - location of pixel to read
  4810.  
  4811.             OUTPUT
  4812.  
  4813.             GETPOINT returns the color index of pixel at X, Y.
  4814.  
  4815.             USAGE
  4816.  
  4817.             GETPOINT returns the value of the pixel at location X, Y.
  4818.             This value is a color index into the current palette.
  4819.  
  4820.             SEE ALSO
  4821.  
  4822.             DRWPOINT
  4823.  
  4824.             EXAMPLE
  4825.  
  4826.             REM DRAW A POINT AND CHECK TO MAKE SURE IT IS THERE
  4827.             $LINK "SVGAPB.PBL"
  4828.             $INCLUDE "SVGAPB.BI"
  4829.  
  4830.             DEFINT A-Z
  4831.             IF WHICHVGA = 0 THEN STOP
  4832.             IF WHICHMEM < 512 THEN STOP
  4833.             VMODE = VIDEOMODEGET
  4834.             DUMMY=RES640
  4835.             DRWPOINT 1, 10, 320, 240
  4836.             POINTVALUE = GETPOINT(320, 240)
  4837.             A$ = "THE POINT VALUE IS:" + STR$(POINTVALUE)
  4838.             DRWSTRING 1, 7, 0, A$, 0, 0
  4839.             WHILE INKEY$ = ""
  4840.             WEND
  4841.             VIDEOMODESET VMODE
  4842.             END
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.                                                                          77
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.           GETSIN
  4864.  
  4865.             PROTOTYPE
  4866.  
  4867.             FUNCTION GETSIN& (Ang&)
  4868.  
  4869.             INPUT
  4870.  
  4871.             Angle - angle in degrees
  4872.  
  4873.             OUTPUT
  4874.  
  4875.             GETSIN returns the sine of Angle scaled up by 13 bits (8192).
  4876.  
  4877.             USAGE
  4878.  
  4879.             GETSIN returns the sine of the specified angle.  Angle can be
  4880.             any long value; floating point values are ignored.  The return
  4881.             value has been multiplied by 8192.  This function uses an
  4882.             integer lookup table stored within the library in order to
  4883.             produce the fastest possible results.  No floating point
  4884.             arithmetic is used.  The scale factor of 13 bits (8192) was
  4885.             chosen because this is the number of bits at which every
  4886.             change of one degree gives a change in the value of the sine
  4887.             (or cosine) function.
  4888.  
  4889.             SEE ALSO
  4890.  
  4891.             GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETTAN
  4892.  
  4893.             EXAMPLE
  4894.  
  4895.             REM SHOW GETSIN
  4896.             $LINK "SVGAPB.PBL"
  4897.             $INCLUDE "SVGAPB.BI"
  4898.             DEFINT A-Z
  4899.  
  4900.             VMODE = VIDEOMODEGET
  4901.             IF WHICHVGA = 0 THEN STOP
  4902.             DUMMY=RES640
  4903.             DRWBOX 1, 10, 0, 0, 639, 479
  4904.             DRWLINE 1, 10, 0, 240, 639, 240
  4905.             DRWLINE 1, 10, 320, 0, 320, 479
  4906.             DEG2RAD! = 4 * ATN(1) / 180
  4907.             FOR I = -360 TO 360
  4908.                Y1& = GETSIN(I)
  4909.                Y1& = Y1& * 240 / 8192
  4910.                Y2& = 240 * SIN(I * DEG2RAD!)
  4911.                DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4912.                DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4913.             NEXT I
  4914.             WHILE INKEY$ = ""
  4915.             WEND
  4916.             VIDEOMODESET VMODE
  4917.  
  4918.  
  4919.                                                                          78
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.             END
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.                                                                          79
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.           GETTAN
  4988.  
  4989.             PROTOTYPE
  4990.  
  4991.             FUNCTION GETTAN& (Ang&)
  4992.  
  4993.             INPUT
  4994.  
  4995.             Angle - angle in degrees
  4996.  
  4997.             OUTPUT
  4998.  
  4999.             GETTAN returns the tangent of Angle scaled up by 13 bits
  5000.             (8192).
  5001.  
  5002.             USAGE
  5003.  
  5004.             GETTAN returns the tangent of the specified angle.  Angle can
  5005.             be any long value except +(90+n*180), where n is an integer.
  5006.             Floating point values are ignored.  The return value has been
  5007.             multiplied by 8192.  If an invalid angle is given, the GETTAN
  5008.             will return &H80000000 (-2147483648).  This function uses an
  5009.             integer lookup table stored within the library in order to
  5010.             produce the fastest possible results.  No floating point
  5011.             arithmetic is used.  The scale factor of 13 bits (8192) was
  5012.             chosen because this is the number of bits at which every
  5013.             change of one degree gives a change in the value of the sine
  5014.             (or cosine) function.
  5015.  
  5016.             SEE ALSO
  5017.  
  5018.             GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETSIN
  5019.  
  5020.             EXAMPLE
  5021.  
  5022.             REM SHOW GETTAN
  5023.             $LINK "SVGAPB.PBL"
  5024.             $INCLUDE "SVGAPB.BI"
  5025.             DEFINT A-Z
  5026.  
  5027.             VMODE = VIDEOMODEGET
  5028.             IF WHICHVGA = 0 THEN STOP
  5029.             DUMMY=RES640
  5030.             DRWBOX 1, 10, 0, 0, 639, 479
  5031.             DRWLINE 1, 10, 0, 240, 639, 240
  5032.             DRWLINE 1, 10, 320, 0, 320, 479
  5033.             DEG2RAD! = 4 * ATN(1) / 180
  5034.             FOR I = -360 TO 360
  5035.                IF ((I - 90) / 180) <> INT((I - 90) / 180) THEN
  5036.                  Y1& = GETTAN(I)
  5037.                  Y1& = Y1& * 240 / 8192
  5038.                  Y2& = 240 * TAN(I * DEG2RAD!)
  5039.                  DRWPOINT 1, 15, 320 + I, 240 - Y1&
  5040.                  DRWPOINT 1, 12, 320 + I, 240 - Y2&
  5041.  
  5042.  
  5043.                                                                          80
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.                END IF
  5050.             NEXT I
  5051.             WHILE INKEY$ = ""
  5052.             WEND
  5053.             VIDEOMODESET VMODE
  5054.             END
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.  
  5105.                                                                          81
  5106.  
  5107.  
  5108.  
  5109.  
  5110.  
  5111.           JOYSTICKINFO
  5112.  
  5113.             PROTOTYPE
  5114.  
  5115.             SUB JOYSTICKINFO (JAX%, JAY%, JAButs%, JBX%, JBY%, JBButs%)
  5116.  
  5117.             INPUT
  5118.  
  5119.             no input parameters
  5120.  
  5121.             OUTPUT
  5122.  
  5123.             no value returned
  5124.             JAX, JAY - horizontal and vertical values of joystick A
  5125.             JAButs - button status of joystick A
  5126.             JBX, JBY - horizontal and vertical values of joystick B
  5127.             JBButs - button status of joystick B
  5128.  
  5129.             USAGE
  5130.  
  5131.             JOYSTICKINFO returns the current status of the two joysticks'
  5132.             position and buttons.  The position is returned in JAX, JAY
  5133.             for joystick A and JBX, JBY for joystick B.  The buttons'
  5134.             status is held in JAButs and JBButs.  For each joystick,
  5135.             button A - usually the fire button - is held in bit zero and
  5136.             button B is in bit one.  Button status is most easily checked
  5137.             with a bitwise AND of JAButs (or JBButs) and the desired bit.
  5138.  
  5139.             Not all joysticks are constructed the same.  In addition,
  5140.             joysticks are not linear devices.  The value of its center
  5141.             will not necessarily be the mean of its extreme values.
  5142.             Therefore, it is recommended that any program using the
  5143.             joystick for more than just directional control complete a
  5144.             calibration of the joystick prior to usage.  For an example of
  5145.             joystick calibration, see the SVGADEMO.EXE source code.
  5146.  
  5147.             SEE ALSO
  5148.  
  5149.             WHICHJOYSTICK
  5150.  
  5151.             EXAMPLE
  5152.  
  5153.             REM DISPLAY THE STATUS OF THE JOYSTICK PORT
  5154.             $LINK "SVGAPB.PBL"
  5155.             $INCLUDE "SVGAPB.BI"
  5156.             DEFINT A-Z
  5157.  
  5158.             CLS
  5159.             WHILE INKEY$ = ""
  5160.                JOYSTICKINFO JAX, JAY, JAButs, JBX, JBY, JBButs
  5161.                LOCATE 1, 1
  5162.                PRINT STRING$(40, 32)
  5163.                LOCATE 1, 1
  5164.                PRINT JAX; JAY; JAButs, JBX; JBY; JBButs;
  5165.  
  5166.  
  5167.                                                                          82
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.                SDELAY 4
  5174.             WEND
  5175.             END
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.                                                                          83
  5230.  
  5231.  
  5232.  
  5233.  
  5234.  
  5235.           MOUSEBUTPRESS
  5236.  
  5237.             PROTOTYPE
  5238.  
  5239.             SUB MOUSEBUTPRESS (ReqBut%, Xloc%, Yloc%, Num%, MButs%)
  5240.  
  5241.             INPUT
  5242.  
  5243.             ReqButton - button for which information is requested
  5244.  
  5245.             OUTPUT
  5246.  
  5247.             no value returned
  5248.             X, Y - current location of mouse cursor
  5249.             Num - number of times button has been pressed since last
  5250.             request
  5251.             MouseButs - current status of the mouse buttons
  5252.  
  5253.             USAGE
  5254.  
  5255.             MOUSEBUTPRESS returns in Num the number of times a mouse
  5256.             button has been pressed since the last call to MOUSEBUTPRESS.
  5257.             In addition the current status of the mouse cursor and buttons
  5258.             is returned.  The position is returned in X, Y.  The buttons'
  5259.             status is held in MouseButs.  The left button is held in bit
  5260.             zero, right button in bit one and center button - for three
  5261.             button mice - in bit two.  Button status is most easily
  5262.             checked with a bitwise AND of MouseButs and the desired bit.
  5263.             The button for which a history is desired is identified by the
  5264.             bits in ReqButton.  However, only one bit may be set.
  5265.             Therefore, only the values of 1, 2 and 4 are permitted.  If
  5266.             more than one bit in ReqButton is set, the function will exit
  5267.             and no information will be returned.
  5268.  
  5269.             SEE ALSO
  5270.  
  5271.             MOUSEBUTRELEASE, MOUSESTATUS
  5272.  
  5273.             EXAMPLE
  5274.  
  5275.             REM ENABLE, SHOW, MOUSE / DISPLAY LEFT BUTTON PRESS HISTORY
  5276.             REM FOR THE LAST 2 SECONDS
  5277.             $LINK "SVGAPB.PBL"
  5278.             $INCLUDE "SVGAPB.BI"
  5279.             DEFINT A-Z
  5280.  
  5281.             VMODE = VIDEOMODEGET
  5282.             IF WHICHVGA = 0 THEN STOP
  5283.             IF WHICHMOUSE = 0 THEN STOP
  5284.             DUMMY=RES640
  5285.             MOUSEENTER
  5286.             MOUSESHOW
  5287.             WHILE INKEY$ = ""
  5288.                MOUSEBUTPRESS 1, X, Y, N, MBUTS
  5289.  
  5290.  
  5291.                                                                          84
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.                D$ = "MX=" + STR$(X)
  5298.                L = LEN(D$)
  5299.                IF L < 10 THEN
  5300.                  D$ = D$ + STRING$(8 - L, 32)
  5301.                END IF
  5302.                D$ = D$ + "MY=" + STR$(Y)
  5303.                L = LEN(D$)
  5304.                IF L < 20 THEN
  5305.                  D$ = D$ + STRING$(16 - L, 32)
  5306.                END IF
  5307.                D$ = D$ + "Number Of Times=" + STR$(N)
  5308.                DRWSTRING 1, 15, 8, D$, 0, 0
  5309.                SDELAY 80
  5310.             WEND
  5311.             MOUSEEXIT
  5312.             VIDEOMODESET VMODE
  5313.             END
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.                                                                          85
  5354.  
  5355.  
  5356.  
  5357.  
  5358.  
  5359.           MOUSEBUTRELEASE
  5360.  
  5361.             PROTOTYPE
  5362.  
  5363.             SUB MOUSEBUTRELEASE (ReqBut%, Xloc%, Yloc%, Num%, MButs%)
  5364.  
  5365.             INPUT
  5366.  
  5367.             ReqButton - button for which information is requested
  5368.  
  5369.             OUTPUT
  5370.  
  5371.             no value returned
  5372.             X, Y - current location of mouse cursor
  5373.             Num - number of times button has been released since last
  5374.             request
  5375.             MouseButs - current status of mouse buttons
  5376.  
  5377.             USAGE
  5378.  
  5379.             MOUSEBUTRELEASE returns in Num the number of times a mouse
  5380.             button has been released since the last call to
  5381.             MOUSEBUTRELEASE.  In addition the current status of the mouse
  5382.             cursor and buttons is returned.  The position is returned in
  5383.             X, Y.  The buttons' status is held in MouseButs.  The left
  5384.             button is held in bit zero, right button in bit one and center
  5385.             button - for three button mice - in bit two.  Button status is
  5386.             most easily checked with a bitwise AND of MouseButs and the
  5387.             desired bit.  The button for which a history is desired is
  5388.             identified by the bits in ReqButton.  However, only one bit
  5389.             may be set.  Therefore, only the values of 1, 2 and 4 are
  5390.             permitted.  If more than one bit in ReqButton is set, the
  5391.             function will exit and no information will be returned.
  5392.  
  5393.             SEE ALSO
  5394.  
  5395.             MOUSEBUTPRESS, MOUSESTATUS
  5396.  
  5397.             EXAMPLE
  5398.  
  5399.             REM ENABLE, SHOW, MOUSE / DISPLAY LEFT BUTTON RELEASE HISTORY
  5400.             REM FOR THE LAST 2 SECONDS
  5401.             $LINK "SVGAPB.PBL"
  5402.             $INCLUDE "SVGAPB.BI"
  5403.             DEFINT A-Z
  5404.  
  5405.             VMODE = VIDEOMODEGET
  5406.             IF WHICHVGA = 0 THEN STOP
  5407.             IF WHICHMOUSE = 0 THEN STOP
  5408.             DUMMY=RES640
  5409.             MOUSEENTER
  5410.             MOUSESHOW
  5411.             WHILE INKEY$ = ""
  5412.                MOUSEBUTRELEASE 1, X, Y, N, MBUTS
  5413.  
  5414.  
  5415.                                                                          86
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.                D$ = "MX=" + STR$(X)
  5422.                L = LEN(D$)
  5423.                IF L < 10 THEN
  5424.                D$ = D$ + STRING$(8 - L, 32)
  5425.                END IF
  5426.                D$ = D$ + "MY=" + STR$(Y)
  5427.                L = LEN(D$)
  5428.                IF L < 20 THEN
  5429.                  D$ = D$ + STRING$(16 - L, 32)
  5430.                END IF
  5431.                D$ = D$ + "Number Of Times=" + STR$(N)
  5432.                DRWSTRING 1, 15, 8, D$, 0, 0
  5433.                SDELAY 80
  5434.             WEND
  5435.             MOUSEEXIT
  5436.             VIDEOMODESET VMODE
  5437.             END
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.                                                                          87
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.           MOUSECURSORDEFAULT
  5484.  
  5485.             PROTOTYPE
  5486.  
  5487.             SUB MOUSECURSORDEFAULT ()
  5488.  
  5489.             INPUT
  5490.  
  5491.             no input parameters
  5492.  
  5493.             OUTPUT
  5494.  
  5495.             no value returned
  5496.  
  5497.             USAGE
  5498.  
  5499.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5500.             arrow with the hot spot in the upper, left corner.  This is
  5501.             the cursor set when MOUSEENTER is called.
  5502.  
  5503.             SEE ALSO
  5504.  
  5505.             MOUSECURSORSET, MOUSEENTER
  5506.  
  5507.             EXAMPLE
  5508.  
  5509.             See MOUSECURSORSET
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.                                                                          88
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.           MOUSECURSORSET
  5546.  
  5547.             PROTOTYPE
  5548.  
  5549.             SUB MOUSECURSORSET (MouseCursor?)
  5550.  
  5551.             INPUT
  5552.  
  5553.             MouseCursor - byte array of 386 elements containing mouse
  5554.             cursor data
  5555.  
  5556.             OUTPUT
  5557.  
  5558.             no value returned
  5559.  
  5560.             USAGE
  5561.  
  5562.             MOUSECURSORSET defines the cursor according to the data in
  5563.             MouseCursor.  The hot spot X and Y location for the cursor is
  5564.             defined by the first two bytes of MouseCursor.  The values for
  5565.             the hot spot must be within the cursor.  Valid values are from
  5566.             0 to 15 for the X location and from 0 to 23 for the Y
  5567.             location.
  5568.  
  5569.             SEE ALSO
  5570.  
  5571.             MOUSECURSORDEFAULT, MOUSEENTER, MOUSESHOW
  5572.  
  5573.             EXAMPLE
  5574.  
  5575.             REM MAKE A BIG CURSOR, THEN RESTORE IT BACK TO THE DEFAULT
  5576.             $LINK "SVGAPB.PBL"
  5577.             $INCLUDE "SVGAPB.BI"
  5578.             DEFINT A-Z
  5579.  
  5580.             VMODE = VIDEOMODEGET
  5581.             IF WHICHVGA = 0 THEN STOP
  5582.             IF WHICHMEM < 512 THEN STOP
  5583.             IF WHICHMOUSE = 0 THEN STOP
  5584.             DUMMY=RES640
  5585.             MOUSEENTER
  5586.             DIM BIGMOUSECURSOR(385) AS BYTE
  5587.             FOR I = 0 TO 385
  5588.                READ BIGMOUSECURSOR(I)
  5589.             NEXT I
  5590.             MOUSECURSORSET BIGMOUSECURSOR(0)
  5591.             MOUSERANGESET 0, 0, 639, 400
  5592.             MOUSESHOW
  5593.             A$ = "Press A Key To Return To The Default Cursor"
  5594.             DRWSTRING 1, 7, 0, A$, 0, 420
  5595.             WHILE INKEY$ = ""
  5596.             WEND
  5597.             MOUSECURSORDEFAULT
  5598.             A$ = "Press A Key To End                         "
  5599.  
  5600.  
  5601.                                                                          89
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.             DRWSTRING 1, 7, 0, A$, 0, 420
  5608.             WHILE INKEY$ = ""
  5609.             WEND
  5610.             MOUSEEXIT
  5611.             VIDEOMODESET VMODE
  5612.             END
  5613.  
  5614.             REM *BIG ARROW MOUSE CURSOR DATA
  5615.             DATA 2,2
  5616.             DATA 0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255
  5617.             DATA 0,15,15,0,0,255,255,255,255,255,255,255,255,255,255,255
  5618.             DATA 0,15,15,15,15,0,0,0,255,255,255,255,255,255,255,255
  5619.             DATA 0,15,15,15,15,15,15,15,0,0,255,255,255,255,255,255
  5620.             DATA 0,15,15,15,15,15,15,15,15,15,0,0,0,255,255,255
  5621.             DATA 0,15,15,15,15,15,15,15,15,15,15,15,15,0,0,255
  5622.             DATA 0,15,15,15,15,15,15,15,15,15,15,15,15,15,0,255
  5623.             DATA 0,15,15,15,15,15,15,15,15,15,15,15,0,0,255,255
  5624.             DATA 0,15,15,15,15,15,15,15,15,15,15,0,255,255,255,255
  5625.             DATA 0,15,15,15,15,15,15,15,15,0,0,255,255,255,255,255
  5626.             DATA 0,15,15,15,15,15,15,15,15,0,255,255,255,255,255,255
  5627.             DATA 0,15,15,15,15,15,0,15,15,15,0,255,255,255,255,255
  5628.             DATA 0,15,15,15,15,0,0,15,15,15,0,255,255,255,255,255
  5629.             DATA 0,15,15,0,0,255,255,0,15,15,15,0,255,255,255,255
  5630.             DATA 0,15,0,255,255,255,255,0,15,15,15,0,255,255,255,255
  5631.             DATA 0,0,255,255,255,255,255,255,0,15,15,15,0,255,255,255
  5632.             DATA 255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255
  5633.             DATA 255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255
  5634.             DATA 255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,255
  5635.             DATA 255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0
  5636.             DATA 255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0
  5637.             DATA 255,255,255,255,255,255,255,255,255,255,255,255,0,15,15,0
  5638.             DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0
  5639.             DATA
  5640.             255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,25
  5641.             5
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.                                                                          90
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.           MOUSEENTER
  5670.  
  5671.             PROTOTYPE
  5672.  
  5673.             SUB MOUSEENTER ()
  5674.  
  5675.             INPUT
  5676.  
  5677.             no input parameters
  5678.  
  5679.             OUTPUT
  5680.  
  5681.             no value returned
  5682.  
  5683.             USAGE
  5684.  
  5685.             MOUSEENTER must be called before any other mouse functions.
  5686.             It initializes all of the mouse abilities including installing
  5687.             the Zephyr mouse display driver.  MOUSEENTER initializes the
  5688.             default mouse cursor, the default sensitivity and sets the
  5689.             range to the current screen resolution.  The mouse cursor
  5690.             location is set to the middle of the screen.
  5691.  
  5692.             SEE ALSO
  5693.  
  5694.             MOUSEEXIT, MOUSEHIDE, MOUSESHOW
  5695.  
  5696.             EXAMPLE
  5697.  
  5698.             REM ENABLE AND SHOW THE MOUSE
  5699.             $LINK "SVGAPB.PBL"
  5700.             $INCLUDE "SVGAPB.BI"
  5701.             DEFINT A-Z
  5702.  
  5703.             VMODE = VIDEOMODEGET
  5704.             IF WHICHVGA = 0 THEN STOP
  5705.             IF WHICHMOUSE = 0 THEN STOP
  5706.             DUMMY=RES640
  5707.             MOUSEENTER
  5708.             MOUSESHOW
  5709.             WHILE INKEY$ = ""
  5710.             WEND
  5711.             MOUSEEXIT
  5712.             VIDEOMODESET VMODE
  5713.             END
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.                                                                          91
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.           MOUSEEXIT
  5732.  
  5733.             PROTOTYPE
  5734.  
  5735.             SUB MOUSEEXIT ()
  5736.  
  5737.             INPUT
  5738.  
  5739.             no input parameters
  5740.  
  5741.             OUTPUT
  5742.  
  5743.             no value returned
  5744.  
  5745.             USAGE
  5746.  
  5747.             MOUSEEXIT properly disables all of the mouse abilities.  This
  5748.             function also removes the Zephyr mouse display driver.  This
  5749.             function should be called prior to exiting any program that
  5750.             previously called MOUSEENTER.
  5751.  
  5752.             SEE ALSO
  5753.  
  5754.             MOUSEENTER, MOUSEHIDE, MOUSESHOW
  5755.  
  5756.             EXAMPLE
  5757.  
  5758.             See MOUSEENTER
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.                                                                          92
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.           MOUSEHIDE
  5794.  
  5795.             PROTOTYPE
  5796.  
  5797.             SUB MOUSEHIDE ()
  5798.  
  5799.             INPUT
  5800.  
  5801.             no input parameters
  5802.  
  5803.             OUTPUT
  5804.  
  5805.             no value returned
  5806.  
  5807.             USAGE
  5808.  
  5809.             MOUSEHIDE turns off the mouse display driver and removes the
  5810.             cursor from the display.  It is recommended to hide the mouse
  5811.             any time something will be drawn in its general vicinity.
  5812.             Note, however, that although the cursor is not visible, all
  5813.             other mouse abilities remain active.
  5814.  
  5815.             SEE ALSO
  5816.  
  5817.             MOUSEENTER, MOUSEEXIT, MOUSESHOW
  5818.  
  5819.             EXAMPLE
  5820.  
  5821.             REM ENABLE, SHOW, AND THE HIDE THE MOUSE
  5822.             $LINK "SVGAPB.PBL"
  5823.             $INCLUDE "SVGAPB.BI"
  5824.             DEFINT A-Z
  5825.  
  5826.             VMODE = VIDEOMODEGET
  5827.             IF WHICHVGA = 0 THEN STOP
  5828.             IF WHICHMOUSE = 0 THEN STOP
  5829.             DUMMY=RES640
  5830.  
  5831.             MOUSEENTER
  5832.             MOUSESHOW
  5833.             WHILE INKEY$ = ""
  5834.             WEND
  5835.             MOUSEHIDE
  5836.  
  5837.             WHILE INKEY$ = ""
  5838.             WEND
  5839.             MOUSEEXIT
  5840.             VIDEOMODESET VMODE
  5841.  
  5842.             END
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.                                                                          93
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.           MOUSEINFO
  5856.  
  5857.             PROTOTYPE
  5858.  
  5859.             SUB MOUSEINFO (DrvMajorVer%, DrvMinorVer%, MouseType%,
  5860.             IRQnumber%)
  5861.  
  5862.             INPUT
  5863.  
  5864.             no input parameters
  5865.  
  5866.             OUTPUT
  5867.  
  5868.             no value returned
  5869.             MajorVersion - Microsoft compatible mouse driver major version
  5870.             number
  5871.             MinorVersion - Microsoft compatible mouse driver minor version
  5872.             number
  5873.             MouseType - type of mouse installed
  5874.             IRQ - the interrupt used by the mouse
  5875.  
  5876.             USAGE
  5877.  
  5878.             MOUSEINFO returns information about the mouse and its
  5879.             installed driver.  The driver must be Microsoft compatible.
  5880.             This information can be used to determine whether the mouse
  5881.             functions in this library will operate correctly.  For proper
  5882.             operation the driver version number must be greater than 1.00.
  5883.             IRQ gives the interrupt number of the mouse - probably 3 or 4.
  5884.             MouseType returns information about the type of hardware
  5885.             installed according to the following table:
  5886.  
  5887.             0 =  unknown type
  5888.             1 =  bus mouse
  5889.             2 =  serial mouse
  5890.             3 =  Inport mouse
  5891.             4 =  PS/2 mouse
  5892.             5 =  HP mouse
  5893.  
  5894.             SEE ALSO
  5895.  
  5896.             WHICHMOUSE
  5897.  
  5898.             EXAMPLE
  5899.  
  5900.             REM RETURN INFORMATION ABOUT THE MOUSE
  5901.             $LINK "SVGAPB.PBL"
  5902.             $INCLUDE "SVGAPB.BI"
  5903.             DEFINT A-Z
  5904.  
  5905.             CLS
  5906.             MOUSE = WHICHMOUSE
  5907.             IF MOUSE > 0 THEN
  5908.                MOUSEINFO MJV, MNV, TP, I
  5909.  
  5910.  
  5911.                                                                          94
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.                VER$ = STR$(MNV)
  5918.                L = LEN(VER$)
  5919.                VER$ = STR$(MJV) + "." + RIGHT$(VER$, L - 1)
  5920.                VER$ = "Software driver version is" + VER$
  5921.                VER$ = VER$ + " (Microsoft equivalent version)."
  5922.                SELECT CASE TP
  5923.                  CASE = 1
  5924.                     MTYPE$ = "bus mouse"
  5925.                  CASE = 2
  5926.                     MTYPE$ = "serial mouse"
  5927.                  CASE = 3
  5928.                     MTYPE$ = "Inport mouse"
  5929.                  CASE = 4
  5930.                     MTYPE$ = "PS/2 mouse"
  5931.                  CASE = 5
  5932.                     MTYPE$ = "HP mouse"
  5933.                  CASE ELSE
  5934.                     MTYPE$ = "unknown type"
  5935.                END SELECT
  5936.                PRINT "Microsoft compatible " + MTYPE$ + " detected with";
  5937.                PRINT STR$(MOUSE) + " buttons on IRQ" + STR$(I) + "."
  5938.                PRINT VER$
  5939.             ELSE
  5940.                PRINT "No Microsoft compatible mouse detected."
  5941.             END IF
  5942.             PRINT
  5943.             WHILE INKEY$ = ""
  5944.             WEND
  5945.             END
  5946.  
  5947.  
  5948.  
  5949.  
  5950.  
  5951.  
  5952.  
  5953.  
  5954.  
  5955.  
  5956.  
  5957.  
  5958.  
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.                                                                          95
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.           MOUSELOCSET
  5980.  
  5981.             PROTOTYPE
  5982.  
  5983.             SUB MOUSELOCSET (Xloc%, Yloc%)
  5984.  
  5985.             INPUT
  5986.  
  5987.             X, Y - location on screen
  5988.  
  5989.             OUTPUT
  5990.  
  5991.             no value returned
  5992.  
  5993.             USAGE
  5994.  
  5995.             MOUSELOCSET moves the mouse cursor the location on the screen
  5996.             specified by X, Y.  If either X or Y is outside of the
  5997.             currently permitted mouse range, it is set to the closest
  5998.             border.  The currently permitted mouse range is the current
  5999.             screen resolution or the last called MOUSERANGESET.
  6000.  
  6001.             SEE ALSO
  6002.  
  6003.             MOUSEENTER, MOUSERANGESET
  6004.  
  6005.             EXAMPLE
  6006.  
  6007.             REM ENABLE AND SHOW THE MOUSE THEN MOVE IT TO THE ORIGIN
  6008.             $LINK "SVGAPB.PBL"
  6009.             $INCLUDE "SVGAPB.BI"
  6010.             DEFINT A-Z
  6011.  
  6012.             VMODE = VIDEOMODEGET
  6013.             IF WHICHVGA = 0 THEN STOP
  6014.             IF WHICHMOUSE = 0 THEN STOP
  6015.             DUMMY=RES640
  6016.             MOUSEENTER
  6017.             MOUSESHOW
  6018.             WHILE INKEY$ = ""
  6019.             WEND
  6020.             MOUSELOCSET 0, 0
  6021.             WHILE INKEY$ = ""
  6022.             WEND
  6023.             MOUSEEXIT
  6024.             VIDEOMODESET VMODE
  6025.             END
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.                                                                          96
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.           MOUSERANGESET
  6042.  
  6043.             PROTOTYPE
  6044.  
  6045.             MOUSERANGESET (X1%, Y1%, X2%, Y2%)
  6046.  
  6047.             INPUT
  6048.  
  6049.             X1, Y1 - location on screen of top, left corner of range
  6050.             X2, Y2 - location on screen of bottom, right corner of range
  6051.  
  6052.             OUTPUT
  6053.  
  6054.             no value returned
  6055.  
  6056.             USAGE
  6057.  
  6058.             MOUSERANGESET defines a permissible range on the screen for
  6059.             mouse movement.  The mouse is automatically positioned in the
  6060.             center of this range.
  6061.  
  6062.             SEE ALSO
  6063.  
  6064.             MOUSELOCSET, MOUSESTATUS
  6065.  
  6066.             EXAMPLE
  6067.  
  6068.             REM ENABLE, SHOW, AND SET A RANGE FOR THE MOUSE
  6069.             $LINK "SVGAPB.PBL"
  6070.             $INCLUDE "SVGAPB.BI"
  6071.             DEFINT A-Z
  6072.  
  6073.             VMODE = VIDEOMODEGET
  6074.             IF WHICHVGA = 0 THEN STOP
  6075.             IF WHICHMOUSE = 0 THEN STOP
  6076.             DUMMY=RES640
  6077.             MOUSEENTER
  6078.             DRWBOX 1, 10, 100, 100, 539, 379
  6079.             MOUSERANGESET 100, 100, 539, 379
  6080.             MOUSESHOW
  6081.             WHILE INKEY$ = ""
  6082.             WEND
  6083.             MOUSEEXIT
  6084.             VIDEOMODESET VMODE
  6085.             END
  6086.  
  6087.  
  6088.  
  6089.  
  6090.  
  6091.  
  6092.  
  6093.  
  6094.  
  6095.  
  6096.  
  6097.                                                                          97
  6098.  
  6099.  
  6100.  
  6101.  
  6102.  
  6103.           MOUSERESTORESTATE
  6104.  
  6105.             PROTOTYPE
  6106.  
  6107.             SUB MOUSERESTORESTATE (MouseBuf?)
  6108.  
  6109.             INPUT
  6110.  
  6111.             MouseBuf - byte array holding complete mouse status
  6112.             information
  6113.  
  6114.             OUTPUT
  6115.  
  6116.             no value returned
  6117.  
  6118.             USAGE
  6119.  
  6120.             MOUSERESTORESTATE completely restores a previously saved mouse
  6121.             status as contained in MouseBuf.  The mouse status must have
  6122.             been already stored in MouseBuf by MOUSESAVESTATE.
  6123.  
  6124.             SEE ALSO
  6125.  
  6126.             MOUSESAVESTATE, MOUSESTORAGESIZE
  6127.  
  6128.             EXAMPLE
  6129.  
  6130.             REM SAVE THE CURRENT MOUSE DRIVER STATUS,SHELL OUT, RESTORE IT
  6131.             $LINK "SVGAPB.PBL"
  6132.             $INCLUDE "SVGAPB.BI"
  6133.             DEFINT A-Z
  6134.  
  6135.             IF WHICHMOUSE = 0 THEN STOP
  6136.             BUFSIZE = MOUSESTORAGESIZE
  6137.             DIM MBUFFER(BUFSIZE) AS BYTE
  6138.             MOUSESAVESTATE MBUFFER(0)
  6139.             PRINT "TYPE 'EXIT' TO RETURN TO THE PROGRAM"
  6140.             SHELL
  6141.             CLS
  6142.             MOUSERESTORESTATE MBUFFER(0)
  6143.             PRINT "DRIVER RESTORED..."
  6144.             WHILE INKEY$ = ""
  6145.             WEND
  6146.             END
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.                                                                          98
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.           MOUSESAVESTATE
  6166.  
  6167.             PROTOTYPE
  6168.  
  6169.             SUB MOUSESAVESTATE (MouseBuf?)
  6170.  
  6171.             INPUT
  6172.  
  6173.             no input parameters
  6174.  
  6175.             OUTPUT
  6176.  
  6177.             no value returned
  6178.             MouseBuf - byte array holding complete mouse status
  6179.             information
  6180.  
  6181.             USAGE
  6182.  
  6183.             MOUSESAVESTATE saves the complete mouse status in MouseBuf.
  6184.             The size of MouseBuf in bytes is defined by MOUSESTORAGESIZE
  6185.             which should called first.
  6186.  
  6187.             SEE ALSO
  6188.  
  6189.             MOUSERESTORESTATE, MOUSESTORAGESIZE
  6190.  
  6191.             EXAMPLE
  6192.  
  6193.             See MOUSERESTORESTATE
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.                                                                          99
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.           MOUSESENSSET
  6228.  
  6229.             PROTOTYPE
  6230.  
  6231.             SUB MOUSESENSSET (Xsens%, Ysens%,DblSpedThrshold%)
  6232.  
  6233.             INPUT
  6234.  
  6235.             XSens - number of mickeys per 8 pixels horizontally (default =
  6236.             4 mickeys per pixel)
  6237.             YSens - number of mickeys per 8 pixels vertically (default = 4
  6238.             mickeys per pixel)
  6239.             DblSpdThresh = number of mickeys per second at which speed is
  6240.             doubled (default = 8)
  6241.  
  6242.             OUTPUT
  6243.  
  6244.             no value returned
  6245.  
  6246.             USAGE
  6247.  
  6248.             MOUSESENSSET defines the relationship between mouse movement
  6249.             and cursor movement on the screen.  A mickey is defined as
  6250.             1/200th of an inch.  The ratio between mickeys and pixels is
  6251.             specified by XSens and YSens in the horizontal and vertical
  6252.             directions respectively.  When the mouse movement is faster
  6253.             than DblSpdThresh in mickeys per second, the speed is doubled.
  6254.             The default values are assigned whenever MOUSEENTER is called.
  6255.  
  6256.             SEE ALSO
  6257.  
  6258.             MOUSEENTER, MOUSEEXIT, MOUSESTATUS
  6259.  
  6260.             EXAMPLE
  6261.  
  6262.             REM ENABLE, SHOW THE MOUSE AND MAKE IT VERY SENSITIVE
  6263.             $LINK "SVGAPB.PBL"
  6264.             $INCLUDE "SVGAPB.BI"
  6265.             DEFINT A-Z
  6266.  
  6267.             VMODE = VIDEOMODEGET
  6268.             IF WHICHVGA = 0 THEN STOP
  6269.             IF WHICHMOUSE = 0 THEN STOP
  6270.             DUMMY=RES640
  6271.             MOUSEENTER
  6272.             MOUSESHOW
  6273.             MOUSESENSSET 2, 2, 4
  6274.             WHILE INKEY$ = ""
  6275.             WEND
  6276.             MOUSEEXIT
  6277.             VIDEOMODESET VMODE
  6278.             END
  6279.  
  6280.  
  6281.  
  6282.  
  6283.                                                                         100
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.           MOUSESHOW
  6290.  
  6291.             PROTOTYPE
  6292.  
  6293.             SUB MOUSESHOW ()
  6294.  
  6295.             INPUT
  6296.  
  6297.             no input parameters
  6298.  
  6299.             OUTPUT
  6300.  
  6301.             no value returned
  6302.  
  6303.             USAGE
  6304.  
  6305.             MOUSESHOW enables the mouse display driver and places the
  6306.             cursor on the screen.  The cursor is only updated when the
  6307.             mouse is moved.  Therefore, it is recommended to hide the
  6308.             cursor when drawing on the screen to avoid unexpected results.
  6309.  
  6310.             SEE ALSO
  6311.  
  6312.             MOUSEENTER, MOUSEEXIT, MOUSEHIDE
  6313.  
  6314.             EXAMPLE
  6315.  
  6316.             See MOUSEHIDE
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.                                                                         101
  6346.  
  6347.  
  6348.  
  6349.  
  6350.  
  6351.           MOUSESTATUS
  6352.  
  6353.             PROTOTYPE
  6354.  
  6355.             SUB MOUSESTATUS (X%, Y%, MButs%)
  6356.  
  6357.             INPUT
  6358.  
  6359.             no input parameters
  6360.  
  6361.             OUTPUT
  6362.  
  6363.             no value returned
  6364.             X, Y - mouse position on screen
  6365.             MouseButs - status of mouse buttons
  6366.  
  6367.             USAGE
  6368.  
  6369.             MOUSESTATUS returns the current status of the mouse position
  6370.             and buttons.  The position is returned in X, Y.  The buttons'
  6371.             status is held in MouseButs.  The left button is held in bit
  6372.             zero, right button in bit one and center button - for three
  6373.             button mice - in bit two.  Button status is most easily
  6374.             checked with a bitwise AND of MouseButs and the desired bit.
  6375.  
  6376.             SEE ALSO
  6377.  
  6378.             MOUSERANGESET, MOUSESENSSET
  6379.  
  6380.             EXAMPLE
  6381.  
  6382.             REM ENABLE, SHOW, DISPLAY MOUSE STATUS
  6383.             $LINK "SVGAPB.PBL"
  6384.             $INCLUDE "SVGAPB.BI"
  6385.             DEFINT A-Z
  6386.             VMODE = VIDEOMODEGET
  6387.             IF WHICHVGA = 0 THEN STOP
  6388.             IF WHICHMOUSE = 0 THEN STOP
  6389.             DUMMY=RES640
  6390.             MOUSEENTER
  6391.             MOUSESHOW
  6392.             WHILE INKEY$ = ""
  6393.                MOUSESTATUS X, Y, MButs
  6394.                D$ = "MX=" + STR$(X)
  6395.                L = LEN(D$)
  6396.                IF L < 10 THEN D$ = D$ + STRING$(8 - L, 32)
  6397.                D$ = D$ + "MY=" + STR$(Y)
  6398.                L = LEN(D$)
  6399.                IF L < 20 THEN
  6400.                  D$ = D$ + STRING$(16 - L, 32)
  6401.                END IF
  6402.                D$ = D$ + "MBUTS=" + STR$(MButs)
  6403.                DRWSTRING 1, 15, 8, D$, 0, 0
  6404.             WEND
  6405.  
  6406.  
  6407.                                                                         102
  6408.  
  6409.  
  6410.  
  6411.  
  6412.  
  6413.             MOUSEEXIT
  6414.             VIDEOMODESET VMODE
  6415.             END
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.                                                                         103
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.           MOUSESTORAGESIZE
  6476.  
  6477.             PROTOTYPE
  6478.  
  6479.             FUNCTION MOUSESTORAGESIZE% ()
  6480.  
  6481.             INPUT
  6482.  
  6483.             no input parameters
  6484.  
  6485.             OUTPUT
  6486.  
  6487.             MOUSESTORAGESIZE returns the number of bytes needed to store
  6488.             the complete mouse status.
  6489.  
  6490.             USAGE
  6491.  
  6492.             MOUSESTORAGESIZE determines the proper size buffer to hold the
  6493.             complete mouse status information.  This buffer should be
  6494.             created before calling MOUSESAVESTATE.
  6495.  
  6496.             SEE ALSO
  6497.  
  6498.             MOUSERESTORESTATE, MOUSESAVESTATE
  6499.  
  6500.             EXAMPLE
  6501.  
  6502.             REM RETURN THE SIZE IN BYTES NEEDED TO SAVE THE MOUSE STATUS
  6503.             $LINK "SVGAPB.PBL"
  6504.             $INCLUDE "SVGAPB.BI"
  6505.             DEFINT A-Z
  6506.  
  6507.             CLS
  6508.             IF WHICHMOUSE = 0 THEN STOP
  6509.             A$ = "The Mouse Driver Requires A" + STR$(MOUSESTORAGESIZE) +
  6510.             " Byte Buffer "
  6511.             A$ = A$ + "To Save Current Status."
  6512.             PRINT A$
  6513.             PRINT
  6514.             WHILE INKEY$ = ""
  6515.             WEND
  6516.             END
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.                                                                         104
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.           OVERSCANSET
  6538.  
  6539.             PROTOTYPE
  6540.  
  6541.             SUB OVERSCANSET (Colr%)
  6542.  
  6543.             INPUT
  6544.  
  6545.             Color - index to color in current palette
  6546.  
  6547.             OUTPUT
  6548.  
  6549.             no value returned
  6550.  
  6551.             USAGE
  6552.  
  6553.             OVERSCANSET sets the overscan region to the specified color.
  6554.             The overscan region is the area between the usable pixel area
  6555.             and the region not scanned by the monitor.  Normally, the
  6556.             overscan is color zero which is defined as black the majority
  6557.             of the time.  The overscan color is reset to zero anytime a
  6558.             RES### function is called.
  6559.  
  6560.             Note: OVERSCANSET always works in the 320x200 resolution.  In
  6561.             the higher resolutions on many common SVGA cards this function
  6562.             is ignored.  Instead, the card always assigns the overscan
  6563.             region to color zero.  Therefore, it is recommended to not use
  6564.             OVERSCANSET, but assign color zero as needed.
  6565.  
  6566.             EXAMPLE
  6567.  
  6568.             REM SET THE OVERSCAN COLOR TO GREEN
  6569.             $LINK "SVGAPB.PBL"
  6570.             $INCLUDE "SVGAPB.BI"
  6571.             DEFINT A-Z
  6572.             VMODE = VIDEOMODEGET
  6573.             IF WHICHVGA = 0 THEN STOP
  6574.             RES320
  6575.             OVERSCANSET 10
  6576.             WHILE INKEY$ = ""
  6577.             WEND
  6578.             VIDEOMODESET VMODE
  6579.             END
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.                                                                         105
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.           PAGEACTIVE
  6600.  
  6601.             PROTOTYPE
  6602.  
  6603.             FUNCTION PAGEACTIVE% (Page%)
  6604.  
  6605.             INPUT
  6606.  
  6607.             Page - number of page to make active
  6608.  
  6609.             OUTPUT
  6610.  
  6611.             PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  6612.  
  6613.             USAGE
  6614.  
  6615.             PAGEACTIVE sets the active page as specified by Page.  It
  6616.             works by creating an offset to be added when any bank
  6617.             switching is performed.  This function does not affect the
  6618.             actual display.  A page is defined as the number of 64K blocks
  6619.             necessary to contain the current screen resolution.  For
  6620.             example, 640x480 requires 307,200 bytes which is a little more
  6621.             than 4.5 64K blocks.  One page in this resolution will be 5
  6622.             banks.
  6623.  
  6624.             PAGEACTIVE does not work in 320x200 mode since this mode uses
  6625.             no bank switching.
  6626.  
  6627.             SEE ALSO
  6628.  
  6629.             PAGEDISPLAY
  6630.  
  6631.             EXAMPLE
  6632.  
  6633.             REM SHOW PAGEACTIVE FUNCTION
  6634.             REM THIS EXAMPLE REQUIRES 1 MEG OF VIDEO MEMORY
  6635.             $LINK "SVGAPB.PBL"
  6636.             $INCLUDE "SVGAPB.BI"
  6637.             DEFINT A-Z
  6638.  
  6639.             IF WHICHVGA = 0 THEN
  6640.                END
  6641.             END IF
  6642.             IF WHICHMEM < 1024 THEN
  6643.                END
  6644.             END IF
  6645.             IF RES640 = 0 THEN
  6646.                END
  6647.             END IF
  6648.  
  6649.             REM MAKE SURE VIDEO CARD SUPPORTS PAGE FLIPPING
  6650.             IF PAGEDISPLAY(0, 0, 0) = 0 THEN
  6651.                DUMMY = RESTEXT
  6652.             END
  6653.  
  6654.  
  6655.                                                                         106
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.             END IF
  6662.             DUMMY = PAGEACTIVE(0)
  6663.             FILLPAGE 0
  6664.             DRWSTRING 1, 10, 0, "PAGE 0", 0, 0
  6665.             DRWSTRING 1, 10, 0, "PRESS A KEY...", 0, 300
  6666.             DUMMY = PAGEACTIVE(1)
  6667.             FILLPAGE 0
  6668.             DRWSTRING 1, 12, 0, "PAGE 1", 0, 20
  6669.             DRWSTRING 1, 12, 0, "PRESS A KEY...", 0, 300
  6670.             DUMMY = PAGEACTIVE(2)
  6671.             FILLPAGE 0
  6672.             DRWSTRING 1, 13, 0, "PAGE 2", 0, 40
  6673.             DRWSTRING 1, 13, 0, "PRESS A KEY...", 0, 300
  6674.             DUMMY = PAGEDISPLAY(0, 0, 0)
  6675.             WHILE INKEY$ = ""
  6676.             WEND
  6677.             DUMMY = PAGEDISPLAY(0, 0, 1)
  6678.             WHILE INKEY$ = ""
  6679.             WEND
  6680.             DUMMY = PAGEDISPLAY(0, 0, 2)
  6681.             WHILE INKEY$ = ""
  6682.             WEND
  6683.             DUMMY = RESTEXT
  6684.             CLS
  6685.             END
  6686.  
  6687.  
  6688.  
  6689.  
  6690.  
  6691.  
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.  
  6698.  
  6699.  
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.                                                                         107
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.           PAGEDISPLAY
  6724.  
  6725.             PROTOTYPE
  6726.  
  6727.             FUNCTION PAGEDISPLAY% (X%, Y%, Page%)
  6728.  
  6729.             INPUT
  6730.  
  6731.             X, Y - coordinate to place at top, left of display
  6732.             Page - number of page to make active
  6733.  
  6734.             OUTPUT
  6735.  
  6736.             PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  6737.  
  6738.             USAGE
  6739.  
  6740.             PAGEDISPLAY tells the video card where in video memory to
  6741.             begin the display.  This display offset is calculated from the
  6742.             specified Page, X and Y.  This is done by multiplying Y times
  6743.             the width of the current resolution, adding X and then adding
  6744.             the appropriate number of 64K blocks for Page.  X, Y and Page
  6745.             must all be positive numbers, but are otherwise not
  6746.             restricted.  The display will wrap if the values are
  6747.             abnormally large.  Wrapping will happen from side to side as
  6748.             well as from top of memory to bottom of memory.
  6749.  
  6750.             PAGEDISPLAY does not work in 320x200 mode since this mode uses
  6751.             no bank switching.  In addition, older models of some SVGA
  6752.             cards operating in native mode do not support paging.  In this
  6753.             library these cards are: Acumos, Ahead version A, Everex and
  6754.             Genoa.  To ensure compatibility, a program should make a call
  6755.             similar to:
  6756.  
  6757.             RET = PAGEDISPLAY(0,0,0)
  6758.             IF RET = 0 THEN PRINT "PAGING NOT SUPPORTED"
  6759.  
  6760.             Note: SVGA cards by ATI Technologies appear to ignore bit 4
  6761.             (counting from 0 to 19) in its linear addressing mode and
  6762.             assume it is zero.  Therefore, bit 4 of the x parameter will
  6763.             be ignored by ATI chipsets.
  6764.  
  6765.             SEE ALSO
  6766.  
  6767.             PAGEACTIVE
  6768.  
  6769.             EXAMPLE
  6770.  
  6771.             See PAGEACTIVE
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.                                                                         108
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.           PALCHGAUTO
  6786.  
  6787.             PROTOTYPE
  6788.  
  6789.             SUB PALCHGAUTO (Pal AS RGBType, NewPal AS RGBType, FirstColr%,
  6790.             LastColr%, Speed%)
  6791.  
  6792.             INPUT
  6793.  
  6794.             Pal - RGBType array with 768 elements containing initial
  6795.             palette
  6796.             NewPal - RGBType array with 768 elements containing new
  6797.             palette
  6798.             FirstColor - index into palette where change will begin
  6799.             LastColor - index into palette where change will end
  6800.             Speed - speed of change
  6801.  
  6802.             OUTPUT
  6803.  
  6804.             no value returned
  6805.  
  6806.             USAGE
  6807.  
  6808.             PALCHGAUTO smoothly fades the colors between FirstColor and
  6809.             LastColor from the palette Pal to NewPal.  The speed of the
  6810.             fade is set by Speed which is percentage change between each
  6811.             step of the fade.  Only values between 1 and 128 are valid
  6812.             where 1 represents a one percent change between steps and 128
  6813.             (80 hex) represents fifty percent change between steps.  A
  6814.             Speed of 128 would then have only two steps.  A Speed outside
  6815.             of the valid range causes the function to immediately return
  6816.             without making any changes.  The time required to accomplish
  6817.             the entire fade is approximately equal to 0.033 seconds times
  6818.             256 divided by Speed.  PALCHGAUTO does not modify either Pal
  6819.             or NewPal.
  6820.  
  6821.             SEE ALSO
  6822.  
  6823.             PALCHGSTEP, PALDIMSTEP, PALIOAUTO
  6824.  
  6825.             EXAMPLE
  6826.  
  6827.             REM AUTOFADE FROM ONE PALETTE TO ANOTHER AND BACK AGAIN
  6828.             $LINK "SVGAPB.PBL"
  6829.             $INCLUDE "SVGAPB.BI"
  6830.             DEFINT A-Z
  6831.             DIM PAL(255) AS RGBType
  6832.             DIM NEWPAL(255) AS RGBType
  6833.  
  6834.             VMODE = VIDEOMODEGET
  6835.             IF WHICHVGA = 0 THEN STOP
  6836.             IF WHICHMEM < 512 THEN STOP
  6837.             DUMMY=RES640
  6838.             PALGET PAL(0), 0, 255
  6839.  
  6840.  
  6841.                                                                         109
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.             FOR I = 0 TO 255
  6848.                NEWPAL(I).R = PAL(I).G
  6849.                NEWPAL(I).G = PAL(I).B
  6850.                NEWPAL(I).B = PAL(I).R
  6851.             NEXT I
  6852.             COLR = 0
  6853.             FOR I = 0 TO 639
  6854.                DRWLINE 1, COLR, I, 0, I, 479
  6855.                COLR = COLR + 1
  6856.                IF COLR > 255 THEN
  6857.                  COLR = 0
  6858.                END IF
  6859.             NEXT I
  6860.             PALCHGAUTO PAL(0), NEWPAL(0), 0, 255, 2
  6861.             PALCHGAUTO NEWPAL(0), PAL(0), 0, 255, 2
  6862.             WHILE INKEY$ = ""
  6863.             WEND
  6864.             VIDEOMODESET VMODE
  6865.             END
  6866.  
  6867.  
  6868.  
  6869.  
  6870.  
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876.  
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.                                                                         110
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.           PALCHGSTEP
  6910.  
  6911.             PROTOTYPE
  6912.  
  6913.             PALCHGSTEP (Pal AS RGBType, NewPal AS RGBType, FirstColr%,
  6914.             LastColr%, Percent%)
  6915.  
  6916.             INPUT
  6917.  
  6918.             Pal - RGBType array with 768 elements containing initial
  6919.             palette
  6920.             NewPal - RGBType array with 768 elements containing new
  6921.             palette
  6922.             FirstColor - index into palette where change will begin
  6923.             LastColor - index into palette where change will end
  6924.             Percent - percent step from current palette to new palette
  6925.  
  6926.             OUTPUT
  6927.  
  6928.             no value returned
  6929.  
  6930.             USAGE
  6931.  
  6932.             PALCHGSTEP changes the palette colors between FirstColor and
  6933.             LastColor by Percent from Pal to NewPal.  This function works
  6934.             very much like PALCHGAUTO except it only takes a single step
  6935.             and returns.  The step taken is a percentage specified by
  6936.             Percent where 256 (100 hex) is a 100 percent change.  The
  6937.             valid range for Percent is 0 to 256.  Values beyond this range
  6938.             cause the function to immediately return without making any
  6939.             changes.  A loop from 4 to 256 by fours using PALCHGSTEP would
  6940.             have similar results as PALCHGAUTO with a speed of 4.  Neither
  6941.             Pal, nor NewPal are modified.
  6942.  
  6943.             SEE ALSO
  6944.  
  6945.             PALCHGAUTO, PALDIMSTEP, PALIOAUTO
  6946.  
  6947.             EXAMPLE
  6948.  
  6949.             REM STEP FADE FROM ONE PALETTE TO ANOTHER AND BACK AGAIN FAST
  6950.             $LINK "SVGAPB.PBL"
  6951.             $INCLUDE "SVGAPB.BI"
  6952.             DEFINT A-Z
  6953.             DIM PAL(255) AS RGBType
  6954.             DIM NEWPAL(255) AS RGBType
  6955.  
  6956.             VMODE = VIDEOMODEGET
  6957.             IF WHICHVGA = 0 THEN STOP
  6958.             IF WHICHMEM < 512 THEN STOP
  6959.             DUMMY=RES640
  6960.             PALGET PAL(0), 0, 255
  6961.             FOR I = 0 TO 255
  6962.                NEWPAL(I).R = PAL(I).G
  6963.  
  6964.  
  6965.                                                                         111
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.                NEWPAL(I).G = PAL(I).B
  6972.                NEWPAL(I).B = PAL(I).R
  6973.             NEXT I
  6974.             COLR = 0
  6975.             FOR I = 0 TO 639
  6976.                DRWLINE 1, COLR, I, 0, I, 479
  6977.                COLR = COLR + 1
  6978.                IF COLR > 255 THEN
  6979.                  COLR = 0
  6980.                END IF
  6981.             NEXT I
  6982.             FOR I = 1 TO 255 STEP 2
  6983.                PALCHGSTEP PAL(0), NEWPAL(0), 0, 255, I
  6984.             NEXT I
  6985.             FOR I = 1 TO 255 STEP 16
  6986.                PALCHGSTEP NEWPAL(0), PAL(0), 0, 255, I
  6987.             NEXT I
  6988.             WHILE INKEY$ = ""
  6989.             WEND
  6990.             VIDEOMODESET VMODE
  6991.             END
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.                                                                         112
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.           PALCOPY
  7034.  
  7035.             PROTOTYPE
  7036.  
  7037.             SUB PALCOPY (SrcPal AS RGBType, DestPal AS RGBType,
  7038.             FirstColr%, LastColr%)
  7039.  
  7040.             INPUT
  7041.  
  7042.             SrcPalette - RGBType array with 768 elements containing source
  7043.             palette
  7044.             FirstColor - index into palette where copy will begin
  7045.             LastColor - index into palette where copy will end
  7046.  
  7047.             OUTPUT
  7048.  
  7049.             no value returned
  7050.             DestPalette - RGBType array with 768 elements containing copy
  7051.             of source palette
  7052.  
  7053.             USAGE
  7054.  
  7055.             PALCOPY quickly copies a source palette into a second palette
  7056.             array.  The source and destination must both be defined as an
  7057.             RGBType array with 768 elements  or PALCOPY will return
  7058.             without making any copy.  A portion of a palette may be copied
  7059.             by specifying first and last colors.
  7060.  
  7061.             SEE ALSO
  7062.  
  7063.             BYTECOPY
  7064.  
  7065.             EXAMPLE
  7066.  
  7067.             REM SHOW PAL COPY
  7068.             $LINK "SVGAPB.PBL"
  7069.             $INCLUDE "SVGAPB.BI"
  7070.             DEFINT A-Z
  7071.             DIM PAL1(255) AS RGBType
  7072.             DIM PAL2(255) AS RGBType
  7073.             VMODE = VIDEOMODEGET
  7074.             IF WHICHVGA = 0 THEN STOP
  7075.             IF WHICHMEM < 512 THEN STOP
  7076.             DUMMY = RES640
  7077.             FOR I = 0 TO 255
  7078.                PAL1(I).R = I
  7079.                PAL1(I).G = I
  7080.                PAL1(I).B = I
  7081.             NEXT I
  7082.             COLR = 0
  7083.             FOR I = 0 TO 639
  7084.                DRWLINE 1, COLR, I, 0, I, 479
  7085.                COLR = COLR + 1
  7086.                IF COLR > 255 THEN COLR = 0
  7087.  
  7088.  
  7089.                                                                         113
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.             NEXT I
  7096.             PALCOPY PAL1(0), PAL2(0), 0, 255
  7097.             PALSET PAL2(0), 0, 255
  7098.             WHILE INKEY$ = ""
  7099.             WEND
  7100.             VIDEOMODESET VMODE
  7101.             END
  7102.  
  7103.  
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.                                                                         114
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.           PALDIMSTEP
  7158.  
  7159.             PROTOTYPE
  7160.  
  7161.             SUB PALDIMSTEP (Pal AS RGBType, FirstColr%, LastColr%,
  7162.             Percent%)
  7163.  
  7164.             INPUT
  7165.  
  7166.             Pal - RGBType array with 768 elements containing initial
  7167.             palette
  7168.             FirstColor - index into palette where dim will begin
  7169.             LastColor - index into palette where dim will end
  7170.             Percent - percent step from current palette to black
  7171.  
  7172.             OUTPUT
  7173.  
  7174.             no value returned
  7175.  
  7176.             USAGE
  7177.  
  7178.             PALDIMSTEP fades the specified palette to black by the given
  7179.             percentage between FirstColor and LastColor.  The percentage
  7180.             step from Pal to black is specified by Percent where 256 (100
  7181.             hex) is full black.  The valid range for Percent is 0 to 256.
  7182.             Values beyond this range cause the function to immediately
  7183.             return without making any changes.  Pal is not modified.
  7184.  
  7185.             SEE ALSO
  7186.  
  7187.             PALCHGAUTO, PALCHGSTEP, PALIOAUTO
  7188.  
  7189.             EXAMPLE
  7190.  
  7191.             REM STEP FADE OUT AND BACK IN FAST
  7192.             $LINK "SVGAPB.PBL"
  7193.             $INCLUDE "SVGAPB.BI"
  7194.             DEFINT A-Z
  7195.             DIM PAL(255) AS RGBType
  7196.             VMODE = VIDEOMODEGET
  7197.             IF WHICHVGA = 0 THEN STOP
  7198.             IF WHICHMEM < 512 THEN STOP
  7199.             DUMMY=RES640
  7200.             PALGET PAL(0), 0, 255
  7201.             COLR = 0
  7202.             FOR I = 0 TO 639
  7203.                DRWLINE 1, COLR, I, 0, I, 479
  7204.                COLR = COLR + 1
  7205.                IF COLR > 255 THEN COLR = 0
  7206.             NEXT I
  7207.             FOR I = 255 TO 0 STEP -2
  7208.                PALDIMSTEP PAL(0), 0, 255, I
  7209.             NEXT I
  7210.             FOR I = 1 TO 255 STEP 16
  7211.  
  7212.  
  7213.                                                                         115
  7214.  
  7215.  
  7216.  
  7217.  
  7218.  
  7219.                PALDIMSTEP PAL(0), 0, 255, I
  7220.             NEXT I
  7221.             WHILE INKEY$ = ""
  7222.             WEND
  7223.             VIDEOMODESET VMODE
  7224.             END
  7225.  
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265.  
  7266.  
  7267.  
  7268.  
  7269.  
  7270.  
  7271.  
  7272.  
  7273.  
  7274.  
  7275.                                                                         116
  7276.  
  7277.  
  7278.  
  7279.  
  7280.  
  7281.           PALGET
  7282.  
  7283.             PROTOTYPE
  7284.  
  7285.             SUB PALGET (Pal AS RGBType, FirstColr%, LastColr%)
  7286.  
  7287.             INPUT
  7288.  
  7289.             FirstColor - index into palette where get will begin
  7290.             LastColor - index into palette where get will end
  7291.  
  7292.             OUTPUT
  7293.  
  7294.             Pal - RGBType array with 768 elements containing the current
  7295.             palette in the specified range
  7296.  
  7297.             USAGE
  7298.  
  7299.             PALGET returns in Pal the colors from the current palette
  7300.             between FirstColor and LastColor.  Only colors in the
  7301.             specified range are returned and all others in Pal are
  7302.             unchanged.  Pal must have a length of 768 elements despite the
  7303.             number of colors retrieved.
  7304.  
  7305.             SEE ALSO
  7306.  
  7307.             PALROTATE, PALSET
  7308.  
  7309.             EXAMPLE
  7310.  
  7311.             REM GET THE CURRENT PALETTE IN THE VARIABLE 'PAL'
  7312.             $LINK "SVGAPB.PBL"
  7313.             $INCLUDE "SVGAPB.BI"
  7314.             DEFINT A-Z
  7315.             DIM PAL AS STRING * 768
  7316.  
  7317.             VMODE = VIDEOMODEGET
  7318.             IF WHICHVGA = 0 THEN STOP
  7319.             IF WHICHMEM < 512 THEN STOP
  7320.             DUMMY=RES640
  7321.             PALGET PAL, 0, 255
  7322.             VIDEOMODESET VMODE
  7323.             CLS
  7324.             PRINT "GOT IT IN 'PAL'..."
  7325.             WHILE INKEY$ = ""
  7326.             WEND
  7327.             END
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.  
  7334.  
  7335.  
  7336.  
  7337.                                                                         117
  7338.  
  7339.  
  7340.  
  7341.  
  7342.  
  7343.           PALIOAUTO
  7344.  
  7345.             PROTOTYPE
  7346.  
  7347.             SUB PALIOAUTO (Pal AS RGBType, FirstColr%, LastColr%, Speed%)
  7348.  
  7349.             INPUT
  7350.  
  7351.             Pal - RGBType array with 768 elements containing initial
  7352.             palette
  7353.             FirstColor - index into palette where fade will begin
  7354.             LastColor - index into palette where fade will end
  7355.             Speed - speed of fade
  7356.  
  7357.             OUTPUT
  7358.  
  7359.             no value returned
  7360.  
  7361.             USAGE
  7362.  
  7363.             PALIOAUTO smoothly fades the colors between FirstColor and
  7364.             LastColor of Pal to or from solid black.  The speed of the
  7365.             fade is set by Speed which is the percentage change between
  7366.             each step of the fade.  A positive Speed corresponds to fading
  7367.             from Pal to black and a negative Speed fades from black to
  7368.             Pal.  Only values between -128 and +128 are valid where  1
  7369.             represents a one percent change between steps and  128 ( 80
  7370.             hex) represents fifty percent change between steps.  A Speed
  7371.             of 128 would then have only two steps.  A Speed outside of the
  7372.             valid range causes the function to immediately return without
  7373.             making any changes.  The time required to accomplish the
  7374.             entire fade is approximately equal to 0.033 seconds times 256
  7375.             divided by Speed.  PALIOAUTO does not modify Pal.
  7376.  
  7377.             SEE ALSO
  7378.  
  7379.             PALCHGAUTO, PALCHGSTEP, PALDIMSTEP
  7380.  
  7381.             EXAMPLE
  7382.  
  7383.             REM FADE OUT AND BACK IN FAST
  7384.             $LINK "SVGAPB.PBL"
  7385.             $INCLUDE "SVGAPB.BI"
  7386.             DEFINT A-Z
  7387.             DIM PAL AS STRING * 768
  7388.             VMODE = VIDEOMODEGET
  7389.             IF WHICHVGA = 0 THEN STOP
  7390.             IF WHICHMEM < 512 THEN STOP
  7391.             DUMMY=RES640
  7392.             PALGET PAL, 0, 255
  7393.             COLR = 0
  7394.             FOR I = 0 TO 639
  7395.                DRWLINE 1, COLR, I, 0, I, 479
  7396.                COLR = COLR + 1
  7397.  
  7398.  
  7399.                                                                         118
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.                IF COLR > 255 THEN COLR = 0
  7406.             NEXT I
  7407.             PALIOAUTO PAL, 0, 255, -2
  7408.             PALIOAUTO PAL, 0, 255, 16
  7409.             WHILE INKEY$ = "" : WEND
  7410.             VIDEOMODESET VMODE
  7411.             END
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.                                                                         119
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.           PALROTATE
  7468.  
  7469.             PROTOTYPE
  7470.  
  7471.             PALROTATE (Pal AS RGBType, FirstColr%, LastColr%, ColShift%)
  7472.  
  7473.             INPUT
  7474.  
  7475.             Pal - RGBType array with 768 elements containing current
  7476.             palette
  7477.             FirstColor - index into palette where shift will begin
  7478.             LastColor - index into palette where shift will end
  7479.             Shift - number of locations to shift colors
  7480.  
  7481.             OUTPUT
  7482.  
  7483.             no value returned
  7484.  
  7485.             USAGE
  7486.  
  7487.             PALROTATE shifts the colors between FirstColor and LastColor
  7488.             by a given number of locations.  The number of locations the
  7489.             colors are moved is specified by Shift which is between 1 and
  7490.             256.  Pal is not modified by PALROTATE.
  7491.  
  7492.             SEE ALSO
  7493.  
  7494.             PALGET, PALSET
  7495.  
  7496.             EXAMPLE
  7497.  
  7498.             REM ROTATE A FEW PALETTE ENTRIES AROUND
  7499.             $LINK "SVGAPB.PBL"
  7500.             $INCLUDE "SVGAPB.BI"
  7501.             DEFINT A-Z
  7502.             DIM PAL(255) AS RGBType
  7503.  
  7504.             VMODE = VIDEOMODEGET
  7505.             IF WHICHVGA = 0 THEN STOP
  7506.             IF WHICHMEM < 512 THEN STOP
  7507.             DUMMY=RES640
  7508.             PALGET PAL(0), 0, 255
  7509.             COLR = 0
  7510.             FOR I = 0 TO 639
  7511.                DRWLINE 1, COLR, I, 0, I, 479
  7512.                COLR = COLR + 1
  7513.                IF COLR > 255 THEN COLR = 0
  7514.             NEXT I
  7515.             FOR I = 0 TO 100
  7516.                PALROTATE PAL(0), 0, 127, 1
  7517.                PALGET PAL(0), 0, 255
  7518.             NEXT I
  7519.             WHILE INKEY$ = ""
  7520.             WEND
  7521.  
  7522.  
  7523.                                                                         120
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.             VIDEOMODESET VMODE
  7530.             END
  7531.  
  7532.  
  7533.  
  7534.  
  7535.  
  7536.  
  7537.  
  7538.  
  7539.  
  7540.  
  7541.  
  7542.  
  7543.  
  7544.  
  7545.  
  7546.  
  7547.  
  7548.  
  7549.  
  7550.  
  7551.  
  7552.  
  7553.  
  7554.  
  7555.  
  7556.  
  7557.  
  7558.  
  7559.  
  7560.  
  7561.  
  7562.  
  7563.  
  7564.  
  7565.  
  7566.  
  7567.  
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.                                                                         121
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.           PALSET
  7592.  
  7593.             PROTOTYPE
  7594.  
  7595.             SUB PALSET (Pal AS RGBType, FirstColr%, LastColr%)
  7596.  
  7597.             INPUT
  7598.  
  7599.             Pal - RGBType array with 768 elements containing the palette
  7600.             to set
  7601.             FirstColor - index into palette where set will begin
  7602.             LastColor - index into palette where set will end
  7603.  
  7604.             OUTPUT
  7605.  
  7606.             no value returned
  7607.  
  7608.             USAGE
  7609.  
  7610.             PALSET sets the specified range of colors in the current
  7611.             palette with the corresponding range in the palette Pal.
  7612.  
  7613.             SEE ALSO
  7614.  
  7615.             PALGET
  7616.  
  7617.             EXAMPLE
  7618.  
  7619.             REM SET A NEW PALETTE
  7620.             $LINK "SVGAPB.PBL"
  7621.             $INCLUDE "SVGAPB.BI"
  7622.             DEFINT A-Z
  7623.             DIM PAL(255) AS RGBType
  7624.             DIM NEWPAL(255) AS RGBType
  7625.  
  7626.             VMODE = VIDEOMODEGET
  7627.             IF WHICHVGA = 0 THEN STOP
  7628.             IF WHICHMEM < 512 THEN STOP
  7629.             DUMMY=RES640
  7630.             PALGET PAL(0), 0, 255
  7631.             FOR I = 0 TO 255
  7632.                NEWPAL(I).R = PAL(I).G
  7633.                NEWPAL(I).G = PAL(I).B
  7634.                NEWPAL(I).B = PAL(I).R
  7635.             NEXT I
  7636.             COLR = 0
  7637.             FOR I = 0 TO 639
  7638.                DRWLINE 1, COLR, I, 0, I, 479
  7639.                COLR = COLR + 1
  7640.                IF COLR > 255 THEN COLR = 0
  7641.             NEXT I
  7642.             PALSET NEWPAL(0), 0, 255
  7643.             WHILE INKEY$ = ""
  7644.             WEND
  7645.  
  7646.  
  7647.                                                                         122
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.             VIDEOMODESET VMODE
  7654.             END
  7655.  
  7656.  
  7657.  
  7658.  
  7659.  
  7660.  
  7661.  
  7662.  
  7663.  
  7664.  
  7665.  
  7666.  
  7667.  
  7668.  
  7669.  
  7670.  
  7671.  
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  
  7679.  
  7680.  
  7681.  
  7682.  
  7683.  
  7684.  
  7685.  
  7686.  
  7687.  
  7688.  
  7689.  
  7690.  
  7691.  
  7692.  
  7693.  
  7694.  
  7695.  
  7696.  
  7697.  
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.                                                                         123
  7710.  
  7711.  
  7712.  
  7713.  
  7714.  
  7715.           PCXGETINFO
  7716.  
  7717.             PROTOTYPE
  7718.  
  7719.             FUNCTION PCXGETINFO% (FileName$, PcxXSize%, PcxYSize%,
  7720.             NumColors%, Pal AS RGBType)
  7721.  
  7722.             INPUT
  7723.  
  7724.             Filename$ - the filename of the PCX image to read
  7725.  
  7726.             OUTPUT
  7727.  
  7728.             PCXGETINFO returns the status of the function (1 = success).
  7729.             Width - the width in pixels of the image
  7730.             Height - the height in pixels of the image
  7731.             NumColors - the number of colors in the image palette
  7732.             Pal - RGBType array with 768 elements containing the image
  7733.             palette
  7734.  
  7735.             USAGE
  7736.  
  7737.             PCXGETINFO reads Filename$ and returns the characteristics of
  7738.             the image.  The dimensions of the image are returned in Width,
  7739.             Height.  The number of colors in the image's palette is
  7740.             returned in NumColors and the palette is returned in Pal.
  7741.             Although the image's palette may contain less than 256 colors,
  7742.             Pal must be 768 elements in length.  The image's palette will
  7743.             begin with the first element of Pal..
  7744.  
  7745.             PCX version 3.0 is the only specification for 256 color
  7746.             images.  Therefore, only version 3.0 PCX files are accepted.
  7747.  
  7748.             If PCXGETINFO determines that Filename$ is a satisfactory
  7749.             file, the function will return a one.  Otherwise, the function
  7750.             will return one of several error codes concerning Filename$ as
  7751.             listed below:
  7752.  
  7753.             0 =  does not exist or there is some disk I/O problem
  7754.             -1 = not a version 3.0 PCX file
  7755.             -2 = not run-length-encoded
  7756.             -3 = general error
  7757.  
  7758.             SEE ALSO
  7759.  
  7760.             PCXMAKE, PCXPUT
  7761.  
  7762.             EXAMPLE
  7763.  
  7764.             REM GET THE INFORMATION OF THE PCX FILE 'ZEPHYR.PCX'
  7765.             $LINK "SVGAPB.PBL"
  7766.             $INCLUDE "SVGAPB.BI"
  7767.  
  7768.             DEFINT A-Z
  7769.  
  7770.  
  7771.                                                                         124
  7772.  
  7773.  
  7774.  
  7775.  
  7776.  
  7777.             DIM PCXPAL(255) AS RGBType
  7778.  
  7779.             DUMMY = WHICHVGA
  7780.             CLS
  7781.             PCXFILENAME$ = "ZEPHYR.PCX"
  7782.             OK = PCXGETINFO(PCXFILENAME$, XSIZE, YSIZE, NUMCOL, PCXPAL(0))
  7783.             IF OK = 1 THEN
  7784.                A$ = "'" + PCXFILENAME$ + "' is identified as a PCX file"
  7785.                PRINT A$
  7786.                A$ = "Dimensions are:" + STR$(XSIZE) + " pixels wide and" +
  7787.             STR$(YSIZE)
  7788.                A$ = A$ + " pixels high"
  7789.                PRINT A$
  7790.                A$ = "Number of colors:" + STR$(NUMCOL)
  7791.                PRINT A$
  7792.             ELSE
  7793.                PRINT "There was an error! -"; OK
  7794.             END IF
  7795.             WHILE INKEY$ = ""
  7796.             WEND
  7797.             END
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.  
  7820.  
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.                                                                         125
  7834.  
  7835.  
  7836.  
  7837.  
  7838.  
  7839.           PCXMAKE
  7840.  
  7841.             PROTOTYPE
  7842.  
  7843.             FUNCTION PCXMAKE% (X1%, Y1%, X2%, Y2%, FileName$)
  7844.  
  7845.             INPUT
  7846.  
  7847.             X1, Y1 - the location of the top, left corner of the image
  7848.             X2, Y2 - the bottom, right corner of the image
  7849.             Filename$ - filename to store the PCX image
  7850.  
  7851.             OUTPUT
  7852.  
  7853.             PCXMAKE returns a 1 if successful, 0 if unsuccessful.
  7854.  
  7855.             USAGE
  7856.  
  7857.             PcxMAKE takes the bitmap enclosed in the box defined by (X1,
  7858.             Y1) - (X2, Y2) and writes a PCX with the filename specified by
  7859.             Filename$.  The resulting file uses the PCX version 3.0
  7860.             specification.  X1, Y1, X2 and Y2 must be valid coordinates on
  7861.             the currently active page.  Filename$ may specify a full path
  7862.             and drive letter, if necessary.
  7863.  
  7864.             If PCXPUT encounters no problems, the function will return a
  7865.             one.  Otherwise, the function will return one of several error
  7866.             codes concerning Filename$ as listed below:
  7867.  
  7868.             0 =  disk I/O problem
  7869.             -1 = coordinates out of range
  7870.  
  7871.             SEE ALSO
  7872.  
  7873.             PCXGETINFO, PCXPUT
  7874.  
  7875.             EXAMPLE
  7876.  
  7877.             REM MAKE A 256 COLOR PCX FILE
  7878.             $LINK "SVGAPB.PBL"
  7879.             $INCLUDE "SVGAPB.BI"
  7880.  
  7881.             DEFINT A-Z
  7882.             IF WHICHCPU < 386 THEN END
  7883.             IF WHICHVGA = 0 THEN END
  7884.  
  7885.             DUMMY = RES640
  7886.             FILLSCREEN 10
  7887.             FOR A = 0 TO 200
  7888.                X1 = RND * GETMAXX
  7889.                Y1 = RND * GETMAXY
  7890.                X2 = RND * GETMAXX
  7891.                Y2 = RND * GETMAXY
  7892.                C = RND * 255
  7893.  
  7894.  
  7895.                                                                         126
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.                DRWLINE 1, C, X1, Y1, X2, Y2
  7902.             NEXT A
  7903.             DRWBOX 1, 15, 0, 0, GETMAXX, GETMAXY
  7904.             A$ = "This PCX file was created using Zephyr Software's
  7905.             'PCXMAKE' function!"
  7906.             DRWSTRING 1, 15, 0, A$, 2, 2
  7907.             ER = PCXMAKE(0, 0, GETMAXX, GETMAXY, "TEST.PCX")
  7908.             WHILE INKEY$ = ""
  7909.             WEND
  7910.             DUMMY = RESTEXT
  7911.             IF ER <> 1 THEN
  7912.                PRINT "PCX MAKE ERROR! -"; ER
  7913.             END IF
  7914.             END
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.  
  7936.  
  7937.  
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943.  
  7944.  
  7945.  
  7946.  
  7947.  
  7948.  
  7949.  
  7950.  
  7951.  
  7952.  
  7953.  
  7954.  
  7955.  
  7956.  
  7957.                                                                         127
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.           PCXPUT
  7964.  
  7965.             PROTOTYPE
  7966.  
  7967.             FUNCTION PCXPUT% (Mode%, Xloc%, Yloc%,  FileName$)
  7968.  
  7969.             INPUT
  7970.  
  7971.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  7972.             X, Y - the location of the top, left corner of the PCX image
  7973.             Filename$ - filename of the PCX image to read
  7974.  
  7975.             OUTPUT
  7976.  
  7977.             PCXPUT returns the status of the function (1 = success).
  7978.  
  7979.             USAGE
  7980.  
  7981.             PCXPUT reads the PCX image from Filename$ and places it on the
  7982.             screen with the top, left corner at X, Y.  The image is
  7983.             automatically clipped to the currently defined viewport.  The
  7984.             image's palette should be previously obtained by using
  7985.             PCXGETINFO.
  7986.  
  7987.             PCX version 3.0 is the only specification for 256 color
  7988.             images.  Therefore, only version 3.0 PCX files are accepted.
  7989.  
  7990.             If PCXPUT encounters no problems, the function will return a
  7991.             one.  Otherwise, the function will return one of several error
  7992.             codes concerning Filename$ as listed below:
  7993.  
  7994.             0 =  does not exist or there is some disk I/O problem
  7995.             -1 = not a version 3.0 PCX file
  7996.             -2 = not run-length-encoded
  7997.             -3 = general error
  7998.  
  7999.             SEE ALSO
  8000.  
  8001.             PCXGETINFO, PCXMAKE, SETVIEW
  8002.  
  8003.             EXAMPLE
  8004.  
  8005.             REM DISPLAY THE PCX FILE 'ZEPHYR.PCX'
  8006.             $LINK "SVGAPB.PBL"
  8007.             $INCLUDE "SVGAPB.BI"
  8008.  
  8009.             DEFINT A-Z
  8010.  
  8011.             DIM PCXPAL(255) AS RGBType
  8012.  
  8013.             IF WHICHVGA = 0 THEN END
  8014.             PCXFILENAME$ = "ZEPHYR.PCX"
  8015.             IF RES640 = 0 THEN END
  8016.  
  8017.  
  8018.  
  8019.                                                                         128
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.             OK = PCXGETINFO(PCXFILENAME$, XSIZE, YSIZE, NUMCOL, PCXPAL(0))
  8026.             IF OK = 1 THEN
  8027.                FIXIT = 0
  8028.                FOR I = 0 TO NUMCOL - 1
  8029.                  IF PCXPAL(I).R > 63 THEN
  8030.                     FIXIT = 1
  8031.                  END IF
  8032.                  IF PCXPAL(I).G > 63 THEN
  8033.                     FIXIT = 1
  8034.                  END IF
  8035.                  IF PCXPAL(I).B > 63 THEN
  8036.                     FIXIT = 1
  8037.                  END IF
  8038.                NEXT I
  8039.                IF FIXIT = 1 THEN
  8040.                  FOR A = 0 TO NUMCOL
  8041.                     SHIFT RIGHT PCXPAL(A).R, 2
  8042.                     SHIFT RIGHT PCXPAL(A).G, 2
  8043.                     SHIFT RIGHT PCXPAL(A).B, 2
  8044.                  NEXT A
  8045.                END IF
  8046.                PALSET PCXPAL(0), 0, 255
  8047.                OK = PCXPUT(1, 0, 0, PCXFILENAME$)
  8048.                IF OK <> 1 THEN
  8049.                  SOUND 100, 5
  8050.                  DUMMY = RESTEXT
  8051.                  END
  8052.                END IF
  8053.                WHILE INKEY$ = ""
  8054.                WEND
  8055.                DUMMY = RESTEXT
  8056.             END IF
  8057.  
  8058.             END
  8059.  
  8060.  
  8061.  
  8062.  
  8063.  
  8064.  
  8065.  
  8066.  
  8067.  
  8068.  
  8069.  
  8070.  
  8071.  
  8072.  
  8073.  
  8074.  
  8075.  
  8076.  
  8077.  
  8078.  
  8079.  
  8080.  
  8081.                                                                         129
  8082.  
  8083.  
  8084.  
  8085.  
  8086.  
  8087.           RES320
  8088.  
  8089.             PROTOTYPE
  8090.  
  8091.             FUNCTION RES320% ()
  8092.  
  8093.             INPUT
  8094.  
  8095.             no input parameters
  8096.  
  8097.             OUTPUT
  8098.  
  8099.             RES320 always returns a 1.
  8100.  
  8101.             USAGE
  8102.  
  8103.             RES320 sets video mode 0x13 which is the VGA standard 320x200
  8104.             graphics mode with 256 colors.  This function can be called
  8105.             without calling WHICHVGA first as this function requires only
  8106.             that a VGA card is present, not a Super VGA card.  If a VGA is
  8107.             not present, the system may crash.
  8108.  
  8109.             SEE ALSO
  8110.  
  8111.             RES640, RES640L, RES800, RES1024, RES1280, WHICHVGA
  8112.  
  8113.             EXAMPLE
  8114.  
  8115.             REM SET THE VIDEO MODE TO 320x200x256
  8116.             $LINK "SVGAPB.PBL"
  8117.             $INCLUDE "SVGAPB.BI"
  8118.             DEFINT A-Z
  8119.  
  8120.             VMODE = VIDEOMODEGET
  8121.             IF WHICHVGA = 0 THEN STOP
  8122.             DUMMY=RES320
  8123.             DRWSTRING 1, 7, 0, "THIS IS THE 320x200x256 VIDEO MODE...", 0,
  8124.             0
  8125.             WHILE INKEY$ = ""
  8126.             WEND
  8127.             VIDEOMODESET VMODE
  8128.             END
  8129.  
  8130.  
  8131.  
  8132.  
  8133.  
  8134.  
  8135.  
  8136.  
  8137.  
  8138.  
  8139.  
  8140.  
  8141.  
  8142.  
  8143.                                                                         130
  8144.  
  8145.  
  8146.  
  8147.  
  8148.  
  8149.           RES640
  8150.  
  8151.             PROTOTYPE
  8152.  
  8153.             FUNCTION RES640% ()
  8154.  
  8155.             INPUT
  8156.  
  8157.             no input parameters
  8158.  
  8159.             OUTPUT
  8160.  
  8161.             RES640 returns 1 if successful, 0 otherwise.
  8162.  
  8163.             USAGE
  8164.  
  8165.             RES640 sets the video mode to 640x480 graphics mode with 256
  8166.             colors.  This function requires that a Super VGA card with at
  8167.             least 512K of video memory be present.  Also, WHICHVGA must be
  8168.             called first or the function will fail without changing the
  8169.             video mode.  If the video card does not have sufficient
  8170.             memory, RES640 will return without changing the video mode.
  8171.  
  8172.             SEE ALSO
  8173.  
  8174.             RES320, RES640L, RES800, RES1024, RES1280, WHICHVGA
  8175.  
  8176.             EXAMPLE
  8177.  
  8178.             REM SET THE VIDEO MODE TO 640x480x256
  8179.             $LINK "SVGAPB.PBL"
  8180.             $INCLUDE "SVGAPB.BI"
  8181.             DEFINT A-Z
  8182.  
  8183.             VMODE = VIDEOMODEGET
  8184.             IF WHICHVGA = 0 THEN STOP
  8185.             IF WHICHMEM < 512 THEN STOP
  8186.             DUMMY=RES640
  8187.             DRWSTRING 1, 7, 0, "THIS IS THE 640x480x256 VIDEO MODE...", 0,
  8188.             0
  8189.             WHILE INKEY$ = ""
  8190.             WEND
  8191.             VIDEOMODESET VMODE
  8192.             END
  8193.  
  8194.  
  8195.  
  8196.  
  8197.  
  8198.  
  8199.  
  8200.  
  8201.  
  8202.  
  8203.  
  8204.  
  8205.                                                                         131
  8206.  
  8207.  
  8208.  
  8209.  
  8210.  
  8211.           RES640L
  8212.  
  8213.             PROTOTYPE
  8214.  
  8215.             FUNCTION RES640L% ()
  8216.  
  8217.             INPUT
  8218.  
  8219.             no input parameters
  8220.  
  8221.             OUTPUT
  8222.  
  8223.             RES640L returns 1 if successful, 0 otherwise.
  8224.  
  8225.             USAGE
  8226.  
  8227.             RES640L sets the video mode to 640x400 graphics mode with 256
  8228.             colors.  This function requires that a Super VGA card with at
  8229.             least 256K of video memory be present.  Also, WHICHVGA must be
  8230.             called first or the function will fail without changing the
  8231.             video mode.  If the video card does not have sufficient
  8232.             memory, RES640L will return without changing the video mode.
  8233.  
  8234.             Note: 640x400 is a non-standard resolution.  Not all SVGA
  8235.             cards recognized by this library support this video mode.
  8236.  
  8237.             SEE ALSO
  8238.  
  8239.             RES320, RES640, RES800, RES1024, RES1280, WHICHVGA
  8240.  
  8241.             EXAMPLE
  8242.  
  8243.             REM SET THE VIDEO MODE TO 640x400x256
  8244.             $LINK "SVGAPB.PBL"
  8245.             $INCLUDE "SVGAPB.BI"
  8246.             DEFINT A-Z
  8247.  
  8248.             VMODE = VIDEOMODEGET
  8249.             IF WHICHVGA = 0 THEN STOP
  8250.             IF WHICHMEM < 256 THEN STOP
  8251.             DUMMY=RES640L
  8252.             DRWSTRING 1, 7, 0, "THIS IS THE 640x400x256 VIDEO MODE...", 0,
  8253.             0
  8254.             WHILE INKEY$ = ""
  8255.             WEND
  8256.             VIDEOMODESET VMODE
  8257.             END
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.  
  8266.  
  8267.                                                                         132
  8268.  
  8269.  
  8270.  
  8271.  
  8272.  
  8273.           RES800
  8274.  
  8275.             PROTOTYPE
  8276.  
  8277.             FUNCTION RES800% ()
  8278.  
  8279.             INPUT
  8280.  
  8281.             no input parameters
  8282.  
  8283.             OUTPUT
  8284.  
  8285.             RES800 returns 1 if successful, 0 otherwise.
  8286.  
  8287.             USAGE
  8288.  
  8289.             RES800 sets the video mode to 800x600 graphics mode with 256
  8290.             colors.  This function requires that a Super VGA card with at
  8291.             least 512K of video memory be present.  Also, WHICHVGA must be
  8292.             called first or the function will fail without changing the
  8293.             video mode.  If the video card does not have sufficient
  8294.             memory, RES800 will return without changing the video mode.
  8295.  
  8296.             SEE ALSO
  8297.  
  8298.             RES320, RES640, RES640L, RES1024, RES1280, WHICHVGA
  8299.  
  8300.             EXAMPLE
  8301.  
  8302.             REM SET THE VIDEO MODE TO 800x600x256
  8303.             $LINK "SVGAPB.PBL"
  8304.             $INCLUDE "SVGAPB.BI"
  8305.             DEFINT A-Z
  8306.  
  8307.             VMODE = VIDEOMODEGET
  8308.             IF WHICHVGA = 0 THEN STOP
  8309.             IF WHICHMEM < 512 THEN STOP
  8310.             DUMMY=RES800
  8311.             DRWSTRING 1, 7, 0, "THIS IS THE 800x600x256 VIDEO MODE...", 0,
  8312.             0
  8313.             WHILE INKEY$ = ""
  8314.             WEND
  8315.             VIDEOMODESET VMODE
  8316.             END
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.  
  8327.  
  8328.  
  8329.                                                                         133
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.           RES1024
  8336.  
  8337.             PROTOTYPE
  8338.  
  8339.             FUNCTION RES1024% ()
  8340.  
  8341.             INPUT
  8342.  
  8343.             no input parameters
  8344.  
  8345.             OUTPUT
  8346.  
  8347.             RES1024 returns 1 if successful, 0 otherwise.
  8348.  
  8349.             USAGE
  8350.  
  8351.             RES1024 sets the video mode to 1024x768 graphics mode with 256
  8352.             colors.  This function requires that a Super VGA card with at
  8353.             least 1 Megabyte of video memory be present.  Also, WHICHVGA
  8354.             must be called first or the function will fail without
  8355.             changing the video mode.  If the video card does not have
  8356.             sufficient memory, RES1024 will return without changing the
  8357.             video mode.
  8358.  
  8359.             SEE ALSO
  8360.  
  8361.             RES320, RES640, RES640L, RES800, RES1280, WHICHVGA
  8362.  
  8363.             EXAMPLE
  8364.  
  8365.             REM SET THE VIDEO MODE TO 1024x768x256
  8366.             $LINK "SVGAPB.PBL"
  8367.             $INCLUDE "SVGAPB.BI"
  8368.             DEFINT A-Z
  8369.  
  8370.             VMODE = VIDEOMODEGET
  8371.             IF WHICHVGA = 0 THEN STOP
  8372.             IF WHICHMEM < 1024 THEN STOP
  8373.             DUMMY=RES1024
  8374.             DRWSTRING 1, 7, 0, "THIS IS THE 1024x768x256 VIDEO MODE...",
  8375.             0, 0
  8376.             WHILE INKEY$ = ""
  8377.             WEND
  8378.             VIDEOMODESET VMODE
  8379.             END
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.  
  8390.  
  8391.                                                                         134
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.           RES1280
  8398.  
  8399.             PROTOTYPE
  8400.  
  8401.             FUNCTION RES1280% ()
  8402.  
  8403.             INPUT
  8404.  
  8405.             no input parameters
  8406.  
  8407.             OUTPUT
  8408.  
  8409.             RES1280 returns 1 if successful, 0 otherwise.
  8410.  
  8411.             USAGE
  8412.  
  8413.             RES1280 sets the video mode to 1280x1024 graphics mode with
  8414.             256 colors.  This function requires that a Super VGA card with
  8415.             at least 2 Megabytes of video memory be present.  Also,
  8416.             WHICHVGA must be called first or the function will fail
  8417.             without changing the video mode.  If the video card does not
  8418.             have sufficient memory, RES1280 will return without changing
  8419.             the video mode.
  8420.  
  8421.             SEE ALSO
  8422.  
  8423.             RES320, RES640, RES640L, RES800, RES1024, WHICHVGA
  8424.  
  8425.             EXAMPLE
  8426.  
  8427.             REM SET THE VIDEO MODE TO 1280x1024x256
  8428.             $LINK "SVGAPB.PBL"
  8429.             $INCLUDE "SVGAPB.BI"
  8430.             DEFINT A-Z
  8431.  
  8432.             VMODE = VIDEOMODEGET
  8433.             IF WHICHVGA = 0 THEN STOP
  8434.             IF WHICHMEM < 2048 THEN STOP
  8435.             DUMMY=RES1280
  8436.             DRWSTRING 1, 7, 0, "THIS IS THE 1280x1024x256 VIDEO MODE...",
  8437.             0, 0
  8438.             WHILE INKEY$ = ""
  8439.             WEND
  8440.             VIDEOMODESET VMODE
  8441.             END
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.                                                                         135
  8454.  
  8455.  
  8456.  
  8457.  
  8458.  
  8459.           RESTEXT
  8460.  
  8461.             PROTOTYPE
  8462.  
  8463.             FUNCTION RESTEXT% ()
  8464.  
  8465.             INPUT
  8466.  
  8467.             no input parameters
  8468.  
  8469.             OUTPUT
  8470.  
  8471.             RESTEXT always returns a 1.
  8472.  
  8473.             USAGE
  8474.  
  8475.             RESTEXT sets video mode three which is the VGA standard 80x25
  8476.             text mode.
  8477.  
  8478.             SEE ALSO
  8479.  
  8480.             VIDEOMODEGET, VIDEOMODESET
  8481.  
  8482.             EXAMPLE
  8483.  
  8484.             REM SET THE VIDEO MODE TO STANDARD DOS TEXT MODE 3
  8485.             $LINK "SVGAPB.PBL"
  8486.             $INCLUDE "SVGAPB.BI"
  8487.             DEFINT A-Z
  8488.  
  8489.             VMODE = VIDEOMODEGET
  8490.             RESTEXT
  8491.             PRINT "THIS IS THE TEXT VIDEO MODE (DOS VIDEO MODE 3)...
  8492.             WHILE INKEY$ = ""
  8493.             WEND
  8494.             VIDEOMODESET VMODE
  8495.             END
  8496.  
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.  
  8514.  
  8515.                                                                         136
  8516.  
  8517.  
  8518.  
  8519.  
  8520.  
  8521.           SCROLLDN
  8522.  
  8523.             PROTOTYPE
  8524.  
  8525.             SUB SCROLLDN (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8526.             INPUT
  8527.  
  8528.             X1, Y1 - top left corner of block
  8529.             X2, Y2 - bottom right corner of block
  8530.             Num - number of pixels to shift
  8531.             Color - index to color in current palette
  8532.  
  8533.             OUTPUT
  8534.  
  8535.             no value returned
  8536.  
  8537.             USAGE
  8538.  
  8539.             SCROLLDN shifts the contents of the box described by (X1, Y1)
  8540.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8541.             empty pixels created at the top of the box are filled with
  8542.             Color.  The pixels that are shifted out of the box are lost.
  8543.             SCROLLDN enforces X2 X1 and Y2Y1.  When placed within a loop,
  8544.             SCROLLDN will create a scrolling effect.
  8545.  
  8546.             SEE ALSO
  8547.  
  8548.             SCROLLLT, SCROLLRT, SCROLLUP
  8549.  
  8550.             EXAMPLE
  8551.  
  8552.             REM SCROLL SOME TEXT DOWN
  8553.             $LINK "SVGAPB.PBL"
  8554.             $INCLUDE "SVGAPB.BI"
  8555.             DEFINT A-Z
  8556.  
  8557.             VMODE = VIDEOMODEGET
  8558.             IF WHICHVGA = 0 THEN STOP
  8559.             IF WHICHMEM < 512 THEN STOP
  8560.             DUMMY=RES640
  8561.             DRWBOX 1, 10, 0, 0, 100, 100
  8562.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8563.             FOR I = 0 TO 40
  8564.                SCROLLDN 1, 1, 99, 99, 1, 0
  8565.                SDELAY 2
  8566.             NEXT I
  8567.             WHILE INKEY$ = ""
  8568.             WEND
  8569.             VIDEOMODESET VMODE
  8570.             END
  8571.  
  8572.  
  8573.  
  8574.  
  8575.  
  8576.  
  8577.                                                                         137
  8578.  
  8579.  
  8580.  
  8581.  
  8582.  
  8583.           SCROLLLT
  8584.  
  8585.             PROTOTYPE
  8586.  
  8587.             SUB SCROLLLT (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8588.  
  8589.             INPUT
  8590.  
  8591.             X1, Y1 - top left corner of block
  8592.             X2, Y2 - bottom right corner of block
  8593.             Num - number of pixels to shift
  8594.             Color - index to color in current palette
  8595.  
  8596.             OUTPUT
  8597.  
  8598.             no value returned
  8599.  
  8600.             USAGE
  8601.  
  8602.             SCROLLLT shifts the contents of the box described by (X1, Y1)
  8603.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8604.             empty pixels created at the right of the box are filled with
  8605.             Color.  The pixels that are shifted out of the box are lost.
  8606.             SCROLLLT enforces X2 X1 and Y2Y1.  When placed within a loop,
  8607.             SCROLLRT will create a scrolling effect.
  8608.  
  8609.             SEE ALSO
  8610.  
  8611.             SCROLLDN, SCROLLRT, SCROLLUP
  8612.  
  8613.             EXAMPLE
  8614.  
  8615.             REM SCROLL SOME TEXT LEFT
  8616.             $LINK "SVGAPB.PBL"
  8617.             $INCLUDE "SVGAPB.BI"
  8618.             DEFINT A-Z
  8619.  
  8620.             VMODE = VIDEOMODEGET
  8621.             IF WHICHVGA = 0 THEN STOP
  8622.             IF WHICHMEM < 512 THEN STOP
  8623.             DUMMY=RES640
  8624.             DRWBOX 1, 10, 0, 0, 100, 100
  8625.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8626.             FOR I = 0 TO 40
  8627.                SCROLLLT 1, 1, 99, 99, 1, 0
  8628.                SDELAY 2
  8629.             NEXT I
  8630.             WHILE INKEY$ = ""
  8631.             WEND
  8632.             VIDEOMODESET VMODE
  8633.             END
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639.                                                                         138
  8640.  
  8641.  
  8642.  
  8643.  
  8644.  
  8645.           SCROLLRT
  8646.  
  8647.             PROTOTYPE
  8648.  
  8649.             SUB SCROLLRT (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8650.  
  8651.             INPUT
  8652.  
  8653.             X1, Y1 - top left corner of block
  8654.             X2, Y2 - bottom right corner of block
  8655.             Num - number of pixels to shift
  8656.             Color - index to color in current palette
  8657.  
  8658.             OUTPUT
  8659.  
  8660.             no value returned
  8661.  
  8662.             USAGE
  8663.  
  8664.             SCROLLRT shifts the contents of the box described by (X1, Y1)
  8665.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8666.             empty pixels created at the left of the box are filled with
  8667.             Color.  The pixels that are shifted out of the box are lost.
  8668.             SCROLLRT enforces X2 X1 and Y2Y1.  When placed within a loop,
  8669.             SCROLLRT will create a scrolling effect.
  8670.  
  8671.             SEE ALSO
  8672.  
  8673.             SCROLLDN, SCROLLLT, SCROLLUP
  8674.  
  8675.             EXAMPLE
  8676.  
  8677.             REM SCROLL SOME TEXT RIGHT
  8678.             $LINK "SVGAPB.PBL"
  8679.             $INCLUDE "SVGAPB.BI"
  8680.             DEFINT A-Z
  8681.  
  8682.             VMODE = VIDEOMODEGET
  8683.             IF WHICHVGA = 0 THEN STOP
  8684.             IF WHICHMEM < 512 THEN STOP
  8685.             DUMMY=RES640
  8686.             DRWBOX 1, 10, 0, 0, 100, 100
  8687.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8688.             FOR I = 0 TO 40
  8689.                SCROLLRT 1, 1, 99, 99, 1, 0
  8690.                SDELAY 2
  8691.             NEXT I
  8692.             WHILE INKEY$ = ""
  8693.             WEND
  8694.             VIDEOMODESET VMODE
  8695.             END
  8696.  
  8697.  
  8698.  
  8699.  
  8700.  
  8701.                                                                         139
  8702.  
  8703.  
  8704.  
  8705.  
  8706.  
  8707.           SCROLLUP
  8708.  
  8709.             PROTOTYPE
  8710.  
  8711.             SUB SCROLLUP (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8712.  
  8713.             INPUT
  8714.  
  8715.             X1, Y1 - top left corner of block
  8716.             X2, Y2 - bottom right corner of block
  8717.             Num - number of pixels to shift
  8718.             Color - index to color in current palette
  8719.  
  8720.             OUTPUT
  8721.  
  8722.             no value returned
  8723.  
  8724.             USAGE
  8725.  
  8726.             SCROLLUP shifts the contents of the box described by (X1, Y1)
  8727.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8728.             empty pixels created at the bottom of the box are filled with
  8729.             Color.  The pixels that are shifted out of the box are lost.
  8730.             SCROLLUP enforces X2 X1 and Y2Y1.  When placed within a loop,
  8731.             SCROLLUP will create a scrolling effect.
  8732.  
  8733.             SEE ALSO
  8734.  
  8735.             SCROLLDN, SCROLLLT, SCROLLRT
  8736.  
  8737.             EXAMPLE
  8738.  
  8739.             REM SCROLL SOME TEXT UP
  8740.             $LINK "SVGAPB.PBL"
  8741.             $INCLUDE "SVGAPB.BI"
  8742.             DEFINT A-Z
  8743.  
  8744.             VMODE = VIDEOMODEGET
  8745.             IF WHICHVGA = 0 THEN STOP
  8746.             IF WHICHMEM < 512 THEN STOP
  8747.             DUMMY=RES640
  8748.             DRWBOX 1, 10, 0, 0, 100, 100
  8749.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8750.             FOR I = 0 TO 40
  8751.                SCROLLUP 1, 1, 99, 99, 1, 0
  8752.                SDELAY 2
  8753.             NEXT I
  8754.             WHILE INKEY$ = ""
  8755.             WEND
  8756.             VIDEOMODESET VMODE
  8757.             END
  8758.  
  8759.  
  8760.  
  8761.  
  8762.  
  8763.                                                                         140
  8764.  
  8765.  
  8766.  
  8767.  
  8768.  
  8769.           SDELAY
  8770.  
  8771.             PROTOTYPE
  8772.  
  8773.             SUB SDELAY (Count%)
  8774.  
  8775.             INPUT
  8776.  
  8777.             Count - number of vertical syncs to wait
  8778.  
  8779.             OUTPUT
  8780.  
  8781.             no value returned
  8782.  
  8783.             USAGE
  8784.  
  8785.             SDELAY pauses execution of the program for a period of time
  8786.             specified by Count.  This delay remains approximately constant
  8787.             on all machines by using the vertical sync timer of the VGA
  8788.             graphics card which is about 60 - 70 Hz.
  8789.  
  8790.             EXAMPLE
  8791.  
  8792.             REM MAKE A DELAY ABOUT 3 SECONDS LONG
  8793.             $LINK "SVGAPB.PBL"
  8794.             $INCLUDE "SVGAPB.BI"
  8795.             DEFINT A-Z
  8796.  
  8797.             CLS
  8798.             PRINT "OK...STARTING DELAY NOW..."
  8799.             PRINT "SHOULD BE ABOUT 3 SECONDS..."
  8800.             PRINT
  8801.             TIM! = TIMER
  8802.             SDELAY 195
  8803.             TOT! = TIMER - TIM!
  8804.             PRINT "ACTUAL TIME WAS:"; TOT!
  8805.             WHILE INKEY$ = ""
  8806.             WEND
  8807.             END
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.  
  8815.  
  8816.  
  8817.  
  8818.  
  8819.  
  8820.  
  8821.  
  8822.  
  8823.  
  8824.  
  8825.                                                                         141
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.           SETCARD
  8832.  
  8833.             PROTOTYPE
  8834.  
  8835.             SUB SETCARD (Chip%, Mem%)
  8836.  
  8837.             INPUT
  8838.  
  8839.             Chip - code for certain SVGA chip type
  8840.             Mem - amount of video memory installed
  8841.  
  8842.             OUTPUT
  8843.  
  8844.             no value returned
  8845.  
  8846.             USAGE
  8847.  
  8848.             WARNING:  USING SETCARD IMPROPERLY MAY CAUSE A SYSTEM FAILURE
  8849.             OR DAMAGE.
  8850.             SETCARD sets the card type and installed video memory.  It can
  8851.             be used instead of the WHICHVGA function.  However, specifying
  8852.             an incorrect chip type or installed video memory may cause
  8853.             unpredictable results not excluding damage to the SVGA card
  8854.             and/or monitor.  Extreme caution is advised when using this
  8855.             function.  It is recommended that this function only be used
  8856.             when it is suspected that the identification process in
  8857.             WHICHVGA failed.  Be absolutely certain that the chip type
  8858.             specified is the actual chip type installed in the computer.
  8859.             Mem should be a value of 256, 512, 1024 or 2048 representing
  8860.             the kilobytes of video memory installed.  Use the following
  8861.             table to identify chip types:
  8862.  
  8863.           1  Acumos AVGA2/3 SuperVGA
  8864.           2  ATI Technologies 18/28/38/68800
  8865.              SuperVGA
  8866.           3  Ahead V5000 ver A SuperVGA
  8867.           4  Ahead V5000 ver B SuperVGA
  8868.           5  Chips and Technologies 82C45x SuperVGA
  8869.           6  Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  8870.              54xx, 62xx SuperVGA
  8871.           7  Everex Micro Enhancer Ev236/6xx
  8872.              SuperVGA
  8873.           8  Genoa 61/62/63/64/6600 SuperVGA
  8874.           9  NCR 77C21/22/22E/22E+ SuperVGA
  8875.           10 Oak Technologies OTI-037C/067/077/087
  8876.              SuperVGA
  8877.           11 Paradise/Western Digital PVGA1A,
  8878.              WD90C00/1x/2x/3x SuperVGA
  8879.           12 Realtek RT3106 SuperVGA
  8880.           13 Trident 8800CS, 8900B/C/CL/CX, 90x0
  8881.              SuperVGA
  8882.           14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  8883.           15 Tseng Labs ET4000/W32/W32I SuperVGA
  8884.           16 VESA compatible SuperVGA
  8885.  
  8886.  
  8887.                                                                         142
  8888.  
  8889.  
  8890.  
  8891.  
  8892.  
  8893.           17 Video 7 HT-208/16 SuperVGA
  8894.           18 Avance Logic AL2101 SuperVGA
  8895.           19 MXIC MX68000/10 SuperVGA
  8896.           20 Primus P2000 SuperVGA
  8897.  
  8898.             SEE ALSO
  8899.  
  8900.             WHICHVGA
  8901.  
  8902.             EXAMPLE
  8903.  
  8904.             REM
  8905.             !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  8906.             NG!
  8907.  
  8908.             REM USE THIS FUNCTION CAREFULLY. IT WORKS AROUND THE "WHICHVGA
  8909.             FUNCTION"
  8910.             REM IMPROPER USE (I.E. SETTING THE CARD ID AND MEMORY TO
  8911.             SOMETHING THAT
  8912.             REM THAT IS NOT VALID) MIGHT DAMAGE YOUR VIDEO CARD/VIDEO
  8913.             MONITOR OR
  8914.             REM CAUSE UNPREDICTABLE RESULTS. IT IS PROVIDED AS A METHOD TO
  8915.             FIND
  8916.             REM FAULTS IN THE VIDEO CARD/CHIP ID PROCESS.
  8917.  
  8918.             REM
  8919.             !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  8920.             NG!
  8921.  
  8922.             END
  8923.  
  8924.  
  8925.  
  8926.  
  8927.  
  8928.  
  8929.  
  8930.  
  8931.  
  8932.  
  8933.  
  8934.  
  8935.  
  8936.  
  8937.  
  8938.  
  8939.  
  8940.  
  8941.  
  8942.  
  8943.  
  8944.  
  8945.  
  8946.  
  8947.  
  8948.  
  8949.                                                                         143
  8950.  
  8951.  
  8952.  
  8953.  
  8954.  
  8955.           SETVIEW
  8956.  
  8957.             PROTOTYPE
  8958.  
  8959.             SUB SETVIEW (X1%, Y1%, X2%, Y2%)
  8960.  
  8961.             INPUT
  8962.  
  8963.             X1, Y1 - top, left corner of view port
  8964.             X2, Y2 - bottom, right corner of view port
  8965.  
  8966.             OUTPUT
  8967.  
  8968.             no value returned
  8969.  
  8970.             USAGE
  8971.  
  8972.             SETVIEW defines a viewport for clipping output on the screen.
  8973.             Nothing can be drawn outside of the currently defined
  8974.             viewport.  The RES### functions set the viewport to the full
  8975.             screen.  The restrictions on X1, Y1, X2 and Y2 are as follows:
  8976.  
  8977.             0   X1 < X2  (screen width)
  8978.             0   Y1 < Y2  (32767, effectively unbounded)
  8979.  
  8980.             SEE ALSO
  8981.  
  8982.             RES320, RES640, RES640L, RES800, RES1024, RES1280
  8983.  
  8984.             EXAMPLE
  8985.  
  8986.             REM DRAW SOME LINES CLIPPED TO A VIEWPORT
  8987.             $LINK "SVGAPB.PBL"
  8988.             $INCLUDE "SVGAPB.BI"
  8989.             DEFINT A-Z
  8990.  
  8991.             VMODE = VIDEOMODEGET
  8992.             IF WHICHVGA = 0 THEN STOP
  8993.             IF WHICHMEM < 512 THEN STOP
  8994.             DUMMY=RES640
  8995.             DRWBOX 1, 15, 100, 100, 539, 379
  8996.             SETVIEW 101, 101, 538, 378
  8997.             FOR I = 0 TO 300
  8998.                X1 = RND * 640
  8999.                Y1 = RND * 480
  9000.                X2 = RND * 640
  9001.                Y2 = RND * 480
  9002.                DRWLINE 1, 10, X1, Y1, X2, Y2
  9003.             NEXT I
  9004.             WHILE INKEY$ = ""
  9005.             WEND
  9006.             VIDEOMODESET VMODE
  9007.             END
  9008.  
  9009.  
  9010.  
  9011.                                                                         144
  9012.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.           SPRITECOLLDETECT
  9018.  
  9019.             PROTOTYPE
  9020.  
  9021.             FUNCTION SPRITECOLLDETECT% (TransColor%, X1%, Y1%, X2%, Y2%,
  9022.             GfxBlk1%, GfxBlk2%)
  9023.  
  9024.             INPUT
  9025.  
  9026.             TransColor - index to color in current palette
  9027.             X1, Y1 - top, left corner of sprite number 1
  9028.             X2, Y2 - top, left corner of sprite number 2
  9029.             GfxBlk1 - predefined integer array containing the sprite
  9030.             number 1
  9031.             GfxBlk2 - predefined integer array containing the sprite
  9032.             number 2
  9033.  
  9034.             OUTPUT
  9035.  
  9036.             SPRITECOLLDETECT returns the collision status of the two
  9037.             sprites.
  9038.  
  9039.             USAGE
  9040.  
  9041.             SPRITECOLLDETECT is used in sprite graphics or animation to
  9042.             report the collision status between two sprites.  GfxBlk1, a
  9043.             short integer array, contains the first sprite which should
  9044.             have been previously defined by BLKGET or similar function.
  9045.             GfxBlk2, likewise, contains the second sprite.  The top, left
  9046.             corner of the first and second sprites' locations are
  9047.             specified by X1, Y1 and X2, Y2, respectively.
  9048.  
  9049.             SPRITECOLLDETECT will return a zero if the sprites are not
  9050.             colliding and the blocks are not overlapping.  The return will
  9051.             be one if the blocks overlap, but the sprites are not
  9052.             colliding.  A return value of two indicates that the sprites
  9053.             have at least one overlapping pixel and are, therefore,
  9054.             colliding.
  9055.  
  9056.             Arrays should be passed by giving the element within the array
  9057.             from where the action should take place.  This allows the
  9058.             programmer to store more than one item within the same array
  9059.             or act on only a portion of the array.
  9060.  
  9061.             SEE ALSO
  9062.  
  9063.             BLKGET, BLKPUT, GETLASTSTRING, SPRITEGAP, SPRITEGET, SPRITEPUT
  9064.  
  9065.             EXAMPLE
  9066.  
  9067.             REM SHOW THE RESULTS OF THE SPRITE COLLISION DETECTION
  9068.             FUNCTION
  9069.             $LINK "SVGAPB.PBL"
  9070.             $INCLUDE "SVGAPB.BI"
  9071.  
  9072.  
  9073.                                                                         145
  9074.  
  9075.  
  9076.  
  9077.  
  9078.  
  9079.  
  9080.             DEFINT A-Z
  9081.  
  9082.             DIM D1(0 TO 4000) AS INTEGER
  9083.             DIM D2(0 TO 4000) AS INTEGER
  9084.  
  9085.             IF WHICHVGA < 0 THEN STOP
  9086.             ORGMODE = VIDEOMODEGET
  9087.             DUMMY=RES320
  9088.             X1 = 0
  9089.             Y1 = 0
  9090.             X2 = 24
  9091.             Y2 = 24
  9092.             DRWLINE 1, 8, X1, Y1, X2, Y1
  9093.             DRWLINE 1, 8, X2, Y1, X2, Y2
  9094.             DRWLINE 1, 8, X2, Y2, X1, Y2
  9095.             DRWLINE 1, 8, X1, Y2, X1, Y1
  9096.             FILLAREA X1 + 1, Y1 + 1, 8, 8
  9097.             DRWLINE 1, 10, X1, Y1, X2, Y2
  9098.             DRWLINE 1, 10, X2, Y1, X1, Y2
  9099.             BLKGET X1, Y1, X2, Y2, D1(0)
  9100.             BLKPUT 2, X1, Y1, D1(0)
  9101.             X1 = 0
  9102.             Y1 = 0
  9103.             X2 = 48
  9104.             Y2 = 48
  9105.             DRWLINE 1, 8, X1, Y1, X2, Y1
  9106.             DRWLINE 1, 8, X2, Y1, X2, Y2
  9107.             DRWLINE 1, 8, X2, Y2, X1, Y2
  9108.             DRWLINE 1, 8, X1, Y2, X1, Y1
  9109.             FILLAREA X1 + 1, Y1 + 1, 8, 8
  9110.             DRWCIRCLE 1, 10, X1 + 24, Y1 + 24, 24
  9111.             BLKGET X1, Y1, X2, Y2, D2(0)
  9112.             BLKPUT 2, X1, Y1, D2(0)
  9113.             X1 = 90
  9114.             Y1 = 90
  9115.             BLKPUT 2, X1, Y1, D2(0)
  9116.             FOR X = 50 TO 150
  9117.                BLKPUT 2, X, X, D1(0)
  9118.                A = SPRITECOLLDETECT(8, X, X, X1, Y1, D1(0), D2(0))
  9119.                A$ = STR$(A)
  9120.                IF LEN(A$) < 5 THEN A$ = A$ + " "
  9121.                DRWSTRING 1, 7, 0, A$, 0, 0
  9122.                WHILE INKEY$ = ""
  9123.                WEND
  9124.                BLKPUT 2, X, X, D1(0)
  9125.             NEXT X
  9126.             VIDEOMODESET ORGMODE
  9127.             END
  9128.  
  9129.  
  9130.  
  9131.  
  9132.  
  9133.  
  9134.  
  9135.                                                                         146
  9136.  
  9137.  
  9138.  
  9139.  
  9140.  
  9141.           SPRITEGAP
  9142.  
  9143.             PROTOTYPE
  9144.  
  9145.             SUB SPRITEGAP (TransColor%, X%, Y%, GfxBlk%, BkGndGfxBlk%)
  9146.  
  9147.             INPUT
  9148.  
  9149.             TransColor - index to color in current palette
  9150.             X, Y - top, left corner of block
  9151.             GfxBlk - predefined integer array containing the sprite
  9152.  
  9153.             OUTPUT
  9154.  
  9155.             no value returned
  9156.             BkGndGfxBlk - integer array holding the sprite background
  9157.  
  9158.             USAGE
  9159.  
  9160.             SPRITEGAP ("Sprite-Get-And-Put") is used in sprite graphics or
  9161.             animation to retrieve a sprite's background and then display
  9162.             the sprite.  GfxBlk, a short integer array, contains the
  9163.             sprite which should have been previously defined by BLKGET or
  9164.             similar function such as GETLASTSTRING.  TransColor is the
  9165.             transparent color assumed in GfxBlk.  BkGndGfxBlk, an empty
  9166.             short integer array the same size as GfxBlk, will receive the
  9167.             sprite's background.  The top, left corner of the sprite's
  9168.             location is specified by X, Y.
  9169.  
  9170.             Arrays should be passed by giving the element within the array
  9171.             from where the action should take place.  This allows the
  9172.             programmer to store more than one item within the same array
  9173.             or act on only a portion of the array.
  9174.  
  9175.             SEE ALSO
  9176.  
  9177.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGET,
  9178.             SPRITEPUT
  9179.  
  9180.             EXAMPLE
  9181.  
  9182.             REM SHOW SPRITEGAP
  9183.             $LINK "SVGAPB.PBL"
  9184.             $INCLUDE "SVGAPB.BI"
  9185.             DEFINT A-Z
  9186.             DIM GFXBLK1(10000)
  9187.             DIM GFXBLK2(10000)
  9188.             DIM GFXBLK3(10000)
  9189.  
  9190.             IF WHICHVGA = 0 THEN STOP
  9191.             VMODE = VIDEOMODEGET
  9192.             IF RES640 <> 1 THEN
  9193.                VIDEOMODESET VMODE
  9194.                END
  9195.  
  9196.  
  9197.                                                                         147
  9198.  
  9199.  
  9200.  
  9201.  
  9202.  
  9203.             END IF
  9204.             Colr = 1
  9205.             FOR I = 0 TO GETMAXX \ 2
  9206.                DRWCIRCLE 1, Colr, GETMAXX \ 4 + I, GETMAXY \ 2, GETMAXY \ 5
  9207.                Colr = Colr + 1
  9208.                IF Colr > 15 THEN
  9209.                  Colr = 1
  9210.                END IF
  9211.             NEXT I
  9212.             XINC = GETMAXX \ 20
  9213.             YINC = GETMAXY \ 20
  9214.             X1 = GETMAXX \ 2 - XINC
  9215.             Y1 = GETMAXY \ 2 - YINC
  9216.             X2 = GETMAXX \ 2 + XINC
  9217.             Y2 = GETMAXY \ 2 + YINC
  9218.             X = (X2 - X1) \ 2 + X1
  9219.             Y = (Y2 - Y1) \ 2 + Y1
  9220.             BLKGET X1, Y1, X2, Y2, GFXBLK1(0)
  9221.             DRWBOX 1, 0, X1, Y1, X2, Y2
  9222.             FILLAREA X1 + 2, Y1 + 2, 0, 0
  9223.             BLKGET X1, Y1, X2, Y2, GFXBLK3(0)
  9224.             FOR I = 0 TO 360 STEP 3
  9225.                DUMMY = BLKROTATE(I, 1, GFXBLK1(0), GFXBLK2(0))
  9226.                SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  9227.             GFXBLK3(0)
  9228.                SPRITEGAP 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  9229.             GFXBLK2(0), GFXBLK3(0)
  9230.                SDELAY 3
  9231.             NEXT I
  9232.             SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  9233.             GFXBLK3(0)
  9234.             BLKPUT 1, X1, Y1, GFXBLK1(0)
  9235.             VIDEOMODESET VMODE
  9236.             END
  9237.  
  9238.  
  9239.  
  9240.  
  9241.  
  9242.  
  9243.  
  9244.  
  9245.  
  9246.  
  9247.  
  9248.  
  9249.  
  9250.  
  9251.  
  9252.  
  9253.  
  9254.  
  9255.  
  9256.  
  9257.  
  9258.  
  9259.                                                                         148
  9260.  
  9261.  
  9262.  
  9263.  
  9264.  
  9265.           SPRITEGET
  9266.  
  9267.             PROTOTYPE
  9268.  
  9269.             SUB SPRITEGET (TransColor%, X%, Y%, GfxBlk%, BkGndGfxBlk%)
  9270.  
  9271.             INPUT
  9272.  
  9273.             TransColor - index to color in current palette
  9274.             X, Y - top, left corner of block
  9275.             GfxBlk - predefined integer array containing the sprite
  9276.  
  9277.             OUTPUT
  9278.  
  9279.             no value returned
  9280.             BkGndGfxBlk - integer array holding the sprite background
  9281.  
  9282.             USAGE
  9283.  
  9284.             SPRITEGET is used in sprite graphics or animation to retrieve
  9285.             the background for a sprite, normally just before using
  9286.             SPRITEPUT.  GfxBlk, a short integer array, contains the sprite
  9287.             which should have been previously defined by BLKGET or similar
  9288.             function.  TransColor is the transparent color assumed in
  9289.             GfxBlk.  BkGndGfxBlk, an empty short integer array of the same
  9290.             size as GfxBlk, will receive the sprite's background.  The
  9291.             top, left corner of the sprite's location is specified by X,
  9292.             Y.
  9293.  
  9294.             Arrays should be passed by giving the element within the array
  9295.             from where the action should take place.  This allows the
  9296.             programmer to store more than one item within the same array
  9297.             or act on only a portion of the array.
  9298.  
  9299.             SEE ALSO
  9300.  
  9301.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  9302.             SPRITEPUT
  9303.  
  9304.             EXAMPLE
  9305.  
  9306.             REM SHOW SPRITEGET
  9307.             $LINK "SVGAPB.PBL"
  9308.             $INCLUDE "SVGAPB.BI"
  9309.             DEFINT A-Z
  9310.             DIM GFXBLK1(10000)
  9311.             DIM GFXBLK2(10000)
  9312.             DIM GFXBLK3(10000)
  9313.  
  9314.             IF WHICHVGA = 0 THEN STOP
  9315.             VMODE = VIDEOMODEGET
  9316.             IF RES640 <> 1 THEN
  9317.                VIDEOMODESET VMODE
  9318.                END
  9319.  
  9320.  
  9321.                                                                         149
  9322.  
  9323.  
  9324.  
  9325.  
  9326.  
  9327.             END IF
  9328.             Colr = 1
  9329.             FOR I = 0 TO GETMAXX \ 2
  9330.                DRWCIRCLE 1, Colr, GETMAXX \ 4 + I, GETMAXY \ 2, GETMAXY \ 5
  9331.                Colr = Colr + 1
  9332.                IF Colr > 15 THEN
  9333.                  Colr = 1
  9334.                END IF
  9335.             NEXT I
  9336.             XINC = GETMAXX \ 20
  9337.             YINC = GETMAXY \ 20
  9338.             X1 = GETMAXX \ 2 - XINC
  9339.             Y1 = GETMAXY \ 2 - YINC
  9340.             X2 = GETMAXX \ 2 + XINC
  9341.             Y2 = GETMAXY \ 2 + YINC
  9342.             X = (X2 - X1) \ 2 + X1
  9343.             Y = (Y2 - Y1) \ 2 + Y1
  9344.             BLKGET X1, Y1, X2, Y2, GFXBLK1(0)
  9345.             DRWBOX 1, 0, X1, Y1, X2, Y2
  9346.             FILLAREA X1 + 2, Y1 + 2, 0, 0
  9347.             BLKGET X1, Y1, X2, Y2, GFXBLK3(0)
  9348.             FOR I = 0 TO 360 STEP 3
  9349.                DUMMY = BLKROTATE(I, 1, GFXBLK1(0), GFXBLK2(0))
  9350.                SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  9351.             GFXBLK3(0)
  9352.                SPRITEGET 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  9353.             GFXBLK2(0), GFXBLK3(0)
  9354.                SPRITEPUT 1, 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  9355.             GFXBLK2(0)
  9356.                SDELAY 3
  9357.             NEXT I
  9358.             SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  9359.             GFXBLK3(0)
  9360.             BLKPUT 1, X1, Y1, GFXBLK1(0)
  9361.             VIDEOMODESET VMODE
  9362.             END
  9363.  
  9364.  
  9365.  
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377.  
  9378.  
  9379.  
  9380.  
  9381.  
  9382.  
  9383.                                                                         150
  9384.  
  9385.  
  9386.  
  9387.  
  9388.  
  9389.           SPRITEPUT
  9390.  
  9391.             PROTOTYPE
  9392.  
  9393.             SUB SPRITEPUT (Mode%, TransColor%, X%, Y%, GfxBlk%)
  9394.  
  9395.             INPUT
  9396.  
  9397.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  9398.             TransColor - index to color in current palette
  9399.             X, Y - top, left corner of block
  9400.             GfxBlk - predefined integer array containing the sprite
  9401.  
  9402.             OUTPUT
  9403.  
  9404.             no value returned
  9405.  
  9406.             USAGE
  9407.  
  9408.             SPRITEPUT is used in sprite graphics or animation to display a
  9409.             sprite or, more commonly, its background.  GfxBlk, a short
  9410.             integer array, contains the sprite which should have been
  9411.             previously defined by BLKGET,  SPRITEGAP or SPRITEGET.
  9412.             TransColor is the transparent color assumed in GfxBlk.  The
  9413.             top, left corner of the sprite's location is specified by X,
  9414.             Y.
  9415.  
  9416.             Arrays should be passed by giving the element within the array
  9417.             from where the action should take place.  This allows the
  9418.             programmer to store more than one item within the same array
  9419.             or act on only a portion of the array.
  9420.  
  9421.             SEE ALSO
  9422.  
  9423.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  9424.             SPRITEGET
  9425.  
  9426.             EXAMPLE
  9427.  
  9428.             See SPRITEGAP
  9429.  
  9430.  
  9431.  
  9432.  
  9433.  
  9434.  
  9435.  
  9436.  
  9437.  
  9438.  
  9439.  
  9440.  
  9441.  
  9442.  
  9443.  
  9444.  
  9445.                                                                         151
  9446.  
  9447.  
  9448.  
  9449.  
  9450.  
  9451.           VIDEOMODEGET
  9452.  
  9453.             PROTOTYPE
  9454.  
  9455.             FUNCTION VIDEOMODEGET% ()
  9456.  
  9457.             INPUT
  9458.  
  9459.             no input parameters
  9460.  
  9461.             OUTPUT
  9462.  
  9463.             VIDEOMODEGET returns the current video mode.
  9464.  
  9465.             USAGE
  9466.  
  9467.             VIDEOMODEGET returns the current video mode.  This function is
  9468.             best used to retrieve the video mode being used when a program
  9469.             begins.  When the program ends, this video mode can then be
  9470.             restored using VIDEOMODESET.
  9471.  
  9472.             SEE ALSO
  9473.  
  9474.             RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  9475.             VIDEOMODESET
  9476.  
  9477.             EXAMPLE
  9478.  
  9479.             REM SAVE THE VIDEO MODE,SWITCH TO 640X480X256, RESTORE THE
  9480.             ORIGINAL MODE
  9481.             $LINK "SVGAPB.PBL"
  9482.             $INCLUDE "SVGAPB.BI"
  9483.             DEFINT A-Z
  9484.  
  9485.             VMODE = VIDEOMODEGET
  9486.             IF WHICHVGA = 0 THEN STOP
  9487.             IF WHICHMEM < 512 THEN STOP
  9488.             DUMMY=RES640
  9489.             DRWSTRING 1, 7, 0, "PRESS A KEY...", 0, 0
  9490.             WHILE INKEY$ = ""
  9491.             WEND
  9492.             VIDEOMODESET VMODE
  9493.             END
  9494.  
  9495.  
  9496.  
  9497.  
  9498.  
  9499.  
  9500.  
  9501.  
  9502.  
  9503.  
  9504.  
  9505.  
  9506.  
  9507.                                                                         152
  9508.  
  9509.  
  9510.  
  9511.  
  9512.  
  9513.           VIDEOMODESET
  9514.  
  9515.             PROTOTYPE
  9516.  
  9517.             SUB VIDEOMODESET (Mode%)
  9518.  
  9519.             INPUT
  9520.  
  9521.             Mode - number of video mode
  9522.  
  9523.             OUTPUT
  9524.  
  9525.             no value returned
  9526.  
  9527.             USAGE
  9528.  
  9529.             VIDEOMODESET sets the video mode specified by Mode.  This
  9530.             function is best used at the end of a program to restore the
  9531.             video mode to the mode in use when the program began.  The
  9532.             program should retrieve the video mode at the beginning by
  9533.             using VIDEOMODEGET.
  9534.  
  9535.             SEE ALSO
  9536.  
  9537.             RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  9538.             VIDEOMODEGET
  9539.  
  9540.             EXAMPLE
  9541.  
  9542.             See VIDEOMODEGET
  9543.  
  9544.  
  9545.  
  9546.  
  9547.  
  9548.  
  9549.  
  9550.  
  9551.  
  9552.  
  9553.  
  9554.  
  9555.  
  9556.  
  9557.  
  9558.  
  9559.  
  9560.  
  9561.  
  9562.  
  9563.  
  9564.  
  9565.  
  9566.  
  9567.  
  9568.  
  9569.                                                                         153
  9570.  
  9571.  
  9572.  
  9573.  
  9574.  
  9575.           VIDEOOFF
  9576.  
  9577.             PROTOTYPE
  9578.  
  9579.             SUB VIDEOOFF ()
  9580.  
  9581.             INPUT
  9582.  
  9583.             no input parameters
  9584.  
  9585.             OUTPUT
  9586.  
  9587.             no value returned
  9588.  
  9589.             USAGE
  9590.  
  9591.             VIDEOOFF turns the output display off.  Graphics may still be
  9592.             drawn to the screen.  However, the computer's monitor will
  9593.             display nothing and appear black.  This function can be used
  9594.             to hide graphics being drawn by initially using VIDEOOFF and
  9595.             then later calling VIDEOON.
  9596.  
  9597.             SEE ALSO
  9598.  
  9599.             VIDEOON
  9600.  
  9601.             EXAMPLE
  9602.  
  9603.             REM DISABLE THE VIDEO FOR ABOUT 3 SEC
  9604.             $LINK "SVGAPB.PBL"
  9605.             $INCLUDE "SVGAPB.BI"
  9606.             DEFINT A-Z
  9607.  
  9608.             CLS
  9609.             PRINT "PRESS A KEY TO DISABLE THE VIDEO DISPLAY FOR 3 SECONDS"
  9610.             WHILE INKEY$ = ""
  9611.             WEND
  9612.             VIDEOOFF
  9613.             SDELAY 195
  9614.             VIDEOON
  9615.             PRINT "OK...WE ARE BACK!"
  9616.             WHILE INKEY$ = ""
  9617.             WEND
  9618.             END
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.  
  9630.  
  9631.                                                                         154
  9632.  
  9633.  
  9634.  
  9635.  
  9636.  
  9637.           VIDEOON
  9638.  
  9639.             PROTOTYPE
  9640.  
  9641.             SUB VIDEOON ()
  9642.  
  9643.             INPUT
  9644.  
  9645.             no input parameters
  9646.  
  9647.             OUTPUT
  9648.  
  9649.             no value returned
  9650.  
  9651.             USAGE
  9652.  
  9653.             VIDEOON turns the display back on.  All graphics that were
  9654.             drawn while the display was off are now visible.  This
  9655.             function can be used to hide graphics being drawn by initially
  9656.             using VIDEOOFF and then later calling VIDEOON.
  9657.  
  9658.             SEE ALSO
  9659.  
  9660.             VIDEOOFF
  9661.  
  9662.             EXAMPLE
  9663.  
  9664.             See VIDEOOFF
  9665.  
  9666.  
  9667.  
  9668.  
  9669.  
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.  
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.  
  9690.  
  9691.  
  9692.  
  9693.                                                                         155
  9694.  
  9695.  
  9696.  
  9697.  
  9698.  
  9699.           WHICHCPU
  9700.  
  9701.             PROTOTYPE
  9702.  
  9703.             FUNCTION WHICHCPU% ()
  9704.  
  9705.             INPUT
  9706.  
  9707.             no input parameters
  9708.  
  9709.             OUTPUT
  9710.  
  9711.             WHICHCPU returns the processor type.
  9712.  
  9713.             USAGE
  9714.  
  9715.             WHICHCPU returns the computer's processor type as 86, 286,
  9716.             386, 486 or 586.  This function should be called by any
  9717.             program using this library's routines to insure that the
  9718.             computer is at least 386 compatible or better.
  9719.  
  9720.             SEE ALSO
  9721.  
  9722.             WHICHJOYSTICK, WHICHMOUSE, WHICHVGA
  9723.  
  9724.             EXAMPLE
  9725.  
  9726.             REM FIND OUT WHAT KIND OF MICROPROCESSOR WE HAVE
  9727.             $LINK "SVGAPB.PBL"
  9728.             $INCLUDE "SVGAPB.BI"
  9729.             DEFINT A-Z
  9730.  
  9731.             CLS
  9732.             CPU = WHICHCPU
  9733.             CPU$ = STR$(CPU)
  9734.             L = LEN(CPU$)
  9735.             CPU$ = RIGHT$(CPU$, L - 1)
  9736.             PRINT "Microprocessor is identified as a 80"; CPU$; "."
  9737.             END
  9738.  
  9739.  
  9740.  
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746.  
  9747.  
  9748.  
  9749.  
  9750.  
  9751.  
  9752.  
  9753.  
  9754.  
  9755.                                                                         156
  9756.  
  9757.  
  9758.  
  9759.  
  9760.  
  9761.           WHICHJOYSTICK
  9762.  
  9763.             PROTOTYPE
  9764.  
  9765.             FUNCTION WHICHJOYSTICK% ()
  9766.  
  9767.             INPUT
  9768.  
  9769.             no input parameters
  9770.  
  9771.             OUTPUT
  9772.  
  9773.             WHICHJOYSTICK returns the available joystick support.
  9774.  
  9775.             USAGE
  9776.  
  9777.             WHICHJOYSTICK returns the joystick support available on the
  9778.             computer.  This function should be called prior to use of the
  9779.             joysticks to verify that joysticks are available.  If the
  9780.             function returns a -1, there is no joystick port present or no
  9781.             BIOS support for a joystick.  Joystick A is bit 1 and B is bit
  9782.             2.  Therefore, a return value of 1 means joystick A is
  9783.             available, a value of 2 means B is available and a value of 3
  9784.             means both are available.  If no bits are set, there are no
  9785.             joysticks present.
  9786.  
  9787.             SEE ALSO
  9788.  
  9789.             JOYSTICKINFO, WHICHCPU, WHICHMOUSE, WHICHVGA
  9790.  
  9791.             EXAMPLE
  9792.  
  9793.             REM FIND OUT IF WE HAVE ANY JOYSTICKS AVAILABLE
  9794.             $LINK "SVGAPB.PBL"
  9795.             $INCLUDE "SVGAPB.BI"
  9796.             DEFINT A-Z
  9797.  
  9798.             CLS
  9799.             JOYSTICK = WHICHJOYSTICK
  9800.             SELECT CASE JOYSTICK
  9801.                CASE IS = -1
  9802.                  A$ = "No joystick port detected or no joystick BIOS
  9803.             support present."
  9804.                CASE IS = 0
  9805.                  A$ = "No joystick detected."
  9806.                CASE IS = 1
  9807.                  A$ = "Joystick A is present and available."
  9808.                CASE IS = 2
  9809.                  A$ = "Joystick B is present and available."
  9810.                CASE IS = 3
  9811.                  A$ = "Both Joystick A and Joystick B are present and
  9812.             available."
  9813.             END SELECT
  9814.             PRINT A$
  9815.  
  9816.  
  9817.                                                                         157
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.             END
  9824.  
  9825.  
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.  
  9832.  
  9833.  
  9834.  
  9835.  
  9836.  
  9837.  
  9838.  
  9839.  
  9840.  
  9841.  
  9842.  
  9843.  
  9844.  
  9845.  
  9846.  
  9847.  
  9848.  
  9849.  
  9850.  
  9851.  
  9852.  
  9853.  
  9854.  
  9855.  
  9856.  
  9857.  
  9858.  
  9859.  
  9860.  
  9861.  
  9862.  
  9863.  
  9864.  
  9865.  
  9866.  
  9867.  
  9868.  
  9869.  
  9870.  
  9871.  
  9872.  
  9873.  
  9874.  
  9875.  
  9876.  
  9877.  
  9878.  
  9879.                                                                         158
  9880.  
  9881.  
  9882.  
  9883.  
  9884.  
  9885.           WHICHMEM
  9886.  
  9887.             PROTOTYPE
  9888.  
  9889.             FUNCTION WHICHMEM% ()
  9890.  
  9891.             INPUT
  9892.  
  9893.             no input parameters
  9894.  
  9895.             OUTPUT
  9896.  
  9897.             WHICHMEM returns the installed video memory in kilobytes.
  9898.  
  9899.             USAGE
  9900.  
  9901.             WHICHMEM returns the amount of installed video memory as
  9902.             previously determined by WHICHVGA.  WHICHVGA should be called
  9903.             prior to WHICHMEM.  This function should be called prior to
  9904.             any of the RES### functions to verify that there is enough
  9905.             memory to support the resolution.  If SETCARD was used to set
  9906.             the video card and memory, WHICHMEM will return the amount of
  9907.             memory as defined by SETCARD.
  9908.  
  9909.             SEE ALSO
  9910.  
  9911.             RES320, RES640, RES640L, RES800, RES1024, RES1280, SETCARD,
  9912.             WHICHVGA
  9913.  
  9914.             EXAMPLE
  9915.  
  9916.             REM FIND OUT HOW MUCH VIDEO MEMORY WE HAVE
  9917.             $LINK "SVGAPB.PBL"
  9918.             $INCLUDE "SVGAPB.BI"
  9919.             DEFINT A-Z
  9920.  
  9921.             CLS
  9922.             DUMMY = WHICHVGA
  9923.             PRINT "INSTALLED VIDEO MEMORY IS IDENTIFIED AS"; WHICHMEM; "k
  9924.             BYTES"
  9925.             END
  9926.  
  9927.  
  9928.  
  9929.  
  9930.  
  9931.  
  9932.  
  9933.  
  9934.  
  9935.  
  9936.  
  9937.  
  9938.  
  9939.  
  9940.  
  9941.                                                                         159
  9942.  
  9943.  
  9944.  
  9945.  
  9946.  
  9947.           WHICHMOUSE
  9948.  
  9949.             PROTOTYPE
  9950.  
  9951.             FUNCTION WHICHMOUSE% ()
  9952.  
  9953.             INPUT
  9954.  
  9955.             no input parameters
  9956.  
  9957.             OUTPUT
  9958.  
  9959.             WHICHMOUSE returns the number of buttons on mouse.
  9960.  
  9961.             USAGE
  9962.  
  9963.             WHICHMOUSE returns a value indicating whether a Microsoft
  9964.             compatible mouse is available.  If the function returns 0, no
  9965.             mouse is available.  A non zero value indicates a mouse and
  9966.             Microsoft compatible driver are installed and gives the number
  9967.             of buttons available.
  9968.  
  9969.             SEE ALSO
  9970.  
  9971.             MOUSEINFO, WHICHCPU, WHICHJOYSTICK, WHICHVGA
  9972.  
  9973.             EXAMPLE
  9974.  
  9975.             REM FIND OUT WHAT KIND OF MOUSE WE HAVE
  9976.             $LINK "SVGAPB.PBL"
  9977.             $INCLUDE "SVGAPB.BI"
  9978.             DEFINT A-Z
  9979.  
  9980.             CLS
  9981.             MOUSE = WHICHMOUSE
  9982.             IF MOUSE > 0 THEN
  9983.                MOUSEINFO MJV, MNV, TP, I
  9984.                VER$ = STR$(MNV)
  9985.                L = LEN(VER$)
  9986.                VER$ = STR$(MJV) + "." + RIGHT$(VER$, L - 1)
  9987.                VER$ = "Software driver version is" + VER$
  9988.                VER$ = VER$ + " (Microsoft equivalent version)."
  9989.                A$ = "Microsoft compatible mouse detected with"
  9990.                A$ = A$ + STR$(MOUSE) + " buttons on IRQ" + STR$(I) + "."
  9991.                PRINT A$
  9992.                PRINT VER$
  9993.             ELSE
  9994.                PRINT "No Microsoft compatible mouse detected."
  9995.             END IF
  9996.             END
  9997.  
  9998.  
  9999.  
  10000.  
  10001.  
  10002.  
  10003.                                                                         160
  10004.  
  10005.  
  10006.  
  10007.  
  10008.  
  10009.           WHICHVGA
  10010.  
  10011.             PROTOTYPE
  10012.  
  10013.             FUNCTION WHICHVGA% ()
  10014.  
  10015.             INPUT
  10016.  
  10017.             no input parameters
  10018.  
  10019.             OUTPUT
  10020.  
  10021.             WHICHVGA returns a code identifying the video card.
  10022.  
  10023.             USAGE
  10024.  
  10025.             WHICHVGA identifies the video card installed and the amount of
  10026.             video memory.  In addition this function sets up the default
  10027.             font and mouse cursor.  This function must be called before
  10028.             any other graphics function.  The code returned identifies the
  10029.             video card according to the following table:
  10030.  
  10031.           1  Acumos AVGA2/3 SuperVGA
  10032.           2  ATI Technologies 18/28/38/68800
  10033.              SuperVGA
  10034.           3  Ahead V5000 ver A SuperVGA
  10035.           4  Ahead V5000 ver B SuperVGA
  10036.           5  Chips and Technologies 82C45x SuperVGA
  10037.           6  Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  10038.              54xx, 62xx SuperVGA
  10039.           7  Everex Micro Enhancer Ev236/6xx
  10040.              SuperVGA
  10041.           8  Genoa 61/62/63/64/6600 SuperVGA
  10042.           9  NCR 77C21/22/22E/22E+ SuperVGA
  10043.           10 Oak Technologies OTI-037C/067/077/087
  10044.              SuperVGA
  10045.           11 Paradise/Western Digital PVGA1A,
  10046.              WD90C00/1x/2x/3x SuperVGA
  10047.           12 Realtek RT3106 SuperVGA
  10048.           13 Trident 8800CS, 8900B/C/CL/CX, 90x0
  10049.              SuperVGA
  10050.           14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  10051.           15 Tseng Labs ET4000/W32/W32I SuperVGA
  10052.           16 VESA compatible SuperVGA
  10053.           17 Video 7 HT-208/16 SuperVGA
  10054.           18 Avance Logic AL2101 SuperVGA
  10055.           19 MXIC MX68000/10 SuperVGA
  10056.           20 Primus P2000 SuperVGA
  10057.  
  10058.             Any value returned not found on this table represents an
  10059.             unidentified video card.
  10060.  
  10061.             No graphics functions should be called unless the video card
  10062.             is properly identified.
  10063.  
  10064.  
  10065.                                                                         161
  10066.  
  10067.  
  10068.  
  10069.  
  10070.  
  10071.  
  10072.             SEE ALSO
  10073.  
  10074.             SETCARD, WHICHCPU, WHICHJOYSTICK, WHICHMOUSE, WHICHMEM
  10075.  
  10076.             EXAMPLE
  10077.  
  10078.             REM FIND OUT WHAT KIND OF VIDEO CARD WE HAVE
  10079.             $LINK "SVGAPB.PBL"
  10080.             $INCLUDE "SVGAPB.BI"
  10081.             DEFINT A-Z
  10082.  
  10083.             CLS
  10084.             VGA = WHICHVGA
  10085.             SELECT CASE VGA
  10086.                  CASE = 1
  10087.                     VGA$ = "Acumos AVGA2/3 SuperVGA"
  10088.                  CASE = 2
  10089.                     VGA$ = "ATI Technologies 18/28/38/68800 SuperVGA"
  10090.                  CASE = 3
  10091.                       VGA$ = "Ahead V5000 ver A SuperVGA"
  10092.                  CASE = 4
  10093.                     VGA$ = "Ahead V5000 ver B SuperVGA"
  10094.                  CASE = 5
  10095.                     VGA$ = "Chips and Technologies 82C450/1/2/3/5/6/7
  10096.           SuperVGA"
  10097.                  CASE = 6
  10098.                     VGA$ = "Cirrus Logic CL-GD 5xx,6xx,28xx,54xx,62xx
  10099.           SuperVGA"
  10100.                  CASE = 7
  10101.                     VGA$ = "Everex Ev236/6xx Micro Enhancer SuperVGA"
  10102.                  CASE = 8
  10103.                     VGA$ = "Genoa 61/62/63/64/6600 SuperVGA"
  10104.                  CASE = 9
  10105.                     VGA$ = "NCR 77C21/22/22E/22E+ SuperVGA"
  10106.                  CASE = 10
  10107.                     VGA$ = "Oak Technologies OTI-037C/067/077/087 SuperVGA"
  10108.                  CASE = 11
  10109.                     VGA$ = "Paradise/Western Digital
  10110.           PVGA1A,WD90C00/1x/2x/3x SuperVGA"
  10111.                  CASE = 12
  10112.                     VGA$ = "Realtek RT3106 SuperVGA"
  10113.                  CASE = 13
  10114.                     VGA$ = "Trident 8800CS,8900B/C/CL/CX,90x0 SuperVGA"
  10115.                  CASE = 14
  10116.                     VGA$ = "Tseng Labs ET3000-AX/BX/BP SuperVGA"
  10117.                  CASE = 15
  10118.                     VGA$ = "Tseng Labs ET4000/W32/W32I SuperVGA"
  10119.                  CASE = 16
  10120.                     VGA$ = "VESA compatible SuperVGA"
  10121.                  CASE = 17
  10122.                     VGA$ = "Video 7 HT-208/16 SuperVGA"
  10123.                  CASE = 18
  10124.                     VGA$ = "Avance Logic AL2101 SuperVGA"
  10125.  
  10126.  
  10127.                                                                         162
  10128.  
  10129.  
  10130.  
  10131.  
  10132.  
  10133.                  CASE = 19
  10134.                     VGA$ = "MXIC MX68000/10 SuperVGA"
  10135.                  CASE = 20
  10136.                     VGA$ = "Primus P2000 SuperVGA"
  10137.                  CASE ELSE
  10138.                     VGA$ = "Unknown"
  10139.                     VGA = 0
  10140.             END SELECT
  10141.             PRINT "Video card/chip is identified as a "; VGA$; "."
  10142.             END
  10143.  
  10144.  
  10145.  
  10146.  
  10147.  
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.  
  10156.  
  10157.  
  10158.  
  10159.  
  10160.  
  10161.  
  10162.  
  10163.  
  10164.  
  10165.  
  10166.  
  10167.  
  10168.  
  10169.  
  10170.  
  10171.  
  10172.  
  10173.  
  10174.  
  10175.  
  10176.  
  10177.  
  10178.  
  10179.  
  10180.  
  10181.  
  10182.  
  10183.  
  10184.  
  10185.  
  10186.  
  10187.  
  10188.  
  10189.                                                                         163
  10190.  
  10191.  
  10192.  
  10193.  
  10194.  
  10195.           WHICHXMS
  10196.  
  10197.             PROTOTYPE
  10198.  
  10199.             FUNCTION WHICHXMS% (XmsKbytesAvailable%, XmsHandlesAvailable%)
  10200.  
  10201.             INPUT
  10202.  
  10203.             no input parameters
  10204.  
  10205.             OUTPUT
  10206.  
  10207.             WHICHXMS returns a 1 if extended memory support is detected, 0
  10208.             otherwise.
  10209.             XmsKBytesAvailable - number of free kilobytes in extended
  10210.             memory
  10211.             XmsHandlesAvailable - number of available free handles
  10212.  
  10213.             USAGE
  10214.  
  10215.             WHICHXMS detects the existence of extended memory support and
  10216.             sets up the library function calls.  This function must be
  10217.             called before any other extended memory functions.  WHICHXMS
  10218.             also returns the number of free kilobytes of extended memory
  10219.             and the number of available handles.  The number of available
  10220.             handles is limited, normally to 32.  This limit can be
  10221.             modified by changing the extended memory driver (Microsoft's
  10222.             HIMEM.SYS is the most common) command line in the CONFIG.SYS
  10223.             file.
  10224.  
  10225.             SEE ALSO
  10226.  
  10227.             XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  10228.  
  10229.             EXAMPLE
  10230.  
  10231.             REM THIS WILL SHOW IF XMS MEMORY IS AVAILABLE AND HOW MUCH
  10232.             $LINK "SVGAPB.PBL"
  10233.             $INCLUDE "SVGAPB.BI"
  10234.             DEFINT A-Z
  10235.  
  10236.             IF WHICHXMS(MEM, HANDLES) = 1 THEN
  10237.                PRINT "AN XMS MEMORY MANAGER IS INSTALLED (SUCH AS
  10238.             'HIMEM.SYS')"
  10239.                IF MEM > 0 THEN
  10240.                  TOTMEM& = 1024
  10241.                  TOTMEM& = TOTMEM& * MEM
  10242.                  PRINT "A TOTAL OF"; TOTMEM&; "BYTES ARE AVAILABLE"
  10243.                  IF HANDLES > 0 THEN
  10244.                     PRINT "A TOTAL OF"; HANDLES; "HANDLES(S) ARE AVAILABLE"
  10245.                     PRINT "XMS MEMORY IS READY FOR USE"
  10246.                  ELSE
  10247.                     PRINT "SORRY...ALL XMS HANDLES ARE BEING USED"
  10248.  
  10249.  
  10250.  
  10251.                                                                         164
  10252.  
  10253.  
  10254.  
  10255.  
  10256.  
  10257.                     PRINT "CHANGE (OR ADD) THE '/numhandles' SWITCH ON YOUR
  10258.             XMS MEMORY MANAGER"
  10259.                  END IF
  10260.                ELSE
  10261.                  PRINT "SORRY...ALL XMS MEMORY IS ALLOCATED"
  10262.                END IF
  10263.             ELSE
  10264.                PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  10265.                PRINT "MAKE SURE YOU HAVE AN XMS MEMORY MANAGER (SUCH AS
  10266.             'HIMEM.SYS' INSTALLED)"
  10267.             END IF
  10268.             END
  10269.  
  10270.  
  10271.  
  10272.  
  10273.  
  10274.  
  10275.  
  10276.  
  10277.  
  10278.  
  10279.  
  10280.  
  10281.  
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.  
  10290.  
  10291.  
  10292.  
  10293.  
  10294.  
  10295.  
  10296.  
  10297.  
  10298.  
  10299.  
  10300.  
  10301.  
  10302.  
  10303.  
  10304.  
  10305.  
  10306.  
  10307.  
  10308.  
  10309.  
  10310.  
  10311.  
  10312.  
  10313.                                                                         165
  10314.  
  10315.  
  10316.  
  10317.  
  10318.  
  10319.           XMSALLOCATE
  10320.  
  10321.             PROTOTYPE
  10322.  
  10323.             FUNCTION XMSALLOCATE% (RequestedKbytes%)
  10324.  
  10325.             INPUT
  10326.  
  10327.             RequestedKBytes - requested number of kilobytes of extended
  10328.             memory
  10329.  
  10330.             OUTPUT
  10331.  
  10332.             XMSALLOCATE returns the assigned memory handle if the
  10333.             allocation is successful, 0 otherwise.
  10334.  
  10335.             USAGE
  10336.  
  10337.             XMSALLOCATE attempts to allocate the requested number of
  10338.             kilobytes in extended memory.  If successful, the function
  10339.             returns the handle of the new memory block.  If the function
  10340.             returns zero, then the allocation was unsuccessful; check
  10341.             XMSERROR for error codes.
  10342.  
  10343.             All allocated blocks must be freed using XMSFREE before a
  10344.             program terminates or the memory is lost until the machine is
  10345.             rebooted.  Simply exiting a program will not free allocated
  10346.             extended memory blocks.
  10347.  
  10348.             SEE ALSO
  10349.  
  10350.             WHICHXMS, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  10351.  
  10352.             EXAMPLE
  10353.  
  10354.             See XMSCOPY
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366.  
  10367.  
  10368.  
  10369.  
  10370.  
  10371.  
  10372.  
  10373.  
  10374.  
  10375.                                                                         166
  10376.  
  10377.  
  10378.  
  10379.  
  10380.  
  10381.           XMSBLKGET
  10382.  
  10383.             PROTOTYPE
  10384.  
  10385.             FUNCTION XMSBLKGET (X1%, Y1%, X2%, Y2%)
  10386.  
  10387.             INPUT
  10388.  
  10389.             X1, Y1 - top left corner of block
  10390.             X2, Y2 - bottom right corner of block
  10391.  
  10392.             OUTPUT
  10393.  
  10394.             Used as a function, XMSBLKGET returns the assigned XMS memory
  10395.             handle if successful, 0 if it otherwise.
  10396.  
  10397.             USAGE
  10398.  
  10399.             XMSBLKGET stores the pixel data contained within the block
  10400.             defined by (X1, Y1)-(X2, Y2) in extended memory.  A minimum of
  10401.             32k of XMS memory will be allocated regardless of the size of
  10402.             the graphics block.  Note that XMSBLKGET enforces X2>X1 and
  10403.             Y2>Y1.  Also, the coordinates must be valid on the screen at
  10404.             the current resolution.  The bitmap is stored such that the
  10405.             first integer in the allocated XMS block is the width and the
  10406.             second integer is the height.  These are followed by a long
  10407.             integer (4 bytes) that specifies the total size of the
  10408.             allocated XMS block.  The remaining bytes are the bitmap
  10409.             raster data stored by rows starting at the top of the block.
  10410.             If the function was unsuccessful, check XMSERROR for error
  10411.             codes.
  10412.  
  10413.             All allocated XMS blocks must be freed using XMSFREE before a
  10414.             program terminates or the memory is lost until the machine is
  10415.             rebooted.  Simply exiting a program will not free allocated
  10416.             extended memory blocks.
  10417.  
  10418.             SEE ALSO
  10419.  
  10420.             BLKGET, BLKPUT, XMSBLKPUT, XMSERROR, XMSFREE, XMSSCREENGET,
  10421.             XMSSCREENPUT
  10422.  
  10423.             EXAMPLE
  10424.  
  10425.             REM THIS WILL COPY A LARGE GRAPHICS BLOCK (ABOUT 80K)
  10426.             REM FROM ONE PART OF THE SCRREN TO ANOTHER
  10427.             $LINK "SVGAPB.PBL"
  10428.             $INCLUDE "SVGAPB.BI"
  10429.             DEFINT A-Z
  10430.  
  10431.             CLS
  10432.             IF WHICHXMS(MEM, HANDLES) = 1 THEN
  10433.                IF MEM < 1 OR HANDLES < 1 THEN
  10434.  
  10435.  
  10436.  
  10437.                                                                         167
  10438.  
  10439.  
  10440.  
  10441.  
  10442.  
  10443.                  PRINT "SORRY...THERE IS EITHER NO FREE XMS MEMORY OR NO
  10444.             FREE XMS HANDLES"
  10445.                  END
  10446.                END IF
  10447.             ELSE
  10448.                PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  10449.                PRINT "MAKE SURE YOU HAVE A XMS MEMORY MANAGER (SUCH AS
  10450.             'HIMEM.SYS' INSTALLED)"
  10451.                END
  10452.             END IF
  10453.             IF WHICHVGA = 0 THEN
  10454.                PRINT "CAN'T ID VIDEO CARD"
  10455.                END
  10456.             END IF
  10457.             DUMMY = RES640
  10458.             DRWFILLBOX 1, 10, 0, 0, 200, 400
  10459.             FOR I = 0 TO 200
  10460.                X1 = RND * 200
  10461.                Y1 = RND * 400
  10462.                X2 = RND * 200
  10463.                Y2 = RND * 400
  10464.                C = RND * 16
  10465.                DRWLINE 1, C, X1, Y1, X2, Y2
  10466.             NEXT I
  10467.             DRWBOX 1, 15, 0, 0, 200, 400
  10468.             REM *ALLOCATE A BLOCK OF XMS MEMORY*
  10469.             OurHandle = XMSBLKGET(0, 0, 200, 400)
  10470.             IF OurHandle = 0 THEN
  10471.                DUMMY = RESTEXT
  10472.                DUMMY = XMSFREE(OurHandle)
  10473.                PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  10474.                END
  10475.             END IF
  10476.             ER = XMSBLKPUT(1, 175, 75, OurHandle)
  10477.             DUMMY = XMSFREE(OurHandle)
  10478.             WHILE INKEY$ = ""
  10479.             WEND
  10480.             DUMMY = RESTEXT
  10481.             END
  10482.  
  10483.  
  10484.  
  10485.  
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.  
  10493.  
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.                                                                         168
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505.           XMSBLKPUT
  10506.  
  10507.             PROTOTYPE
  10508.  
  10509.             FUNCTION XMSBLKPUT (Mode%, X%, Y%, SrcXmsHandle%)
  10510.  
  10511.             INPUT
  10512.  
  10513.             Mode - pixel write mode (set=1, xor=2, or=3, and=4)
  10514.             X, Y - location for top left corner of block
  10515.             SrcXmsHandle - handle of source extended memory block
  10516.  
  10517.             OUTPUT
  10518.  
  10519.             Used as a function, XMSBLKPUT returns a 1 if successful, 0
  10520.             otherwise.
  10521.  
  10522.             USAGE
  10523.  
  10524.             XMSBLKPUT places the pixel data contained in XMS memory
  10525.             referenced by SrcXmsHandle on the screen.  The top, left
  10526.             corner of the block is specified by (x, y).  Any (x, y) is
  10527.             acceptable and any portion of the block that lies outside of
  10528.             the currently defined viewport will not be drawn.  If the
  10529.             function was unsuccessful, check XMSERROR for error codes.
  10530.  
  10531.             All allocated XMS blocks must be freed using XMSFREE before a
  10532.             program terminates or the memory is lost until the machine is
  10533.             rebooted.  Simply exiting a program will not free allocated
  10534.             extended memory blocks.
  10535.  
  10536.             SEE ALSO
  10537.  
  10538.             BLKGET, BLKPUT, XMSBLKGET, XMSERROR, XMSFREE, XMSSCREENGET,
  10539.             XMSSCREENPUT
  10540.  
  10541.             EXAMPLE
  10542.  
  10543.             See XMSBLKGET
  10544.  
  10545.  
  10546.  
  10547.  
  10548.  
  10549.  
  10550.  
  10551.  
  10552.  
  10553.  
  10554.  
  10555.  
  10556.  
  10557.  
  10558.  
  10559.  
  10560.  
  10561.                                                                         169
  10562.  
  10563.  
  10564.  
  10565.  
  10566.  
  10567.           XMSCOPY
  10568.  
  10569.             PROTOTYPE
  10570.  
  10571.             FUNCTION XMSCOPY% (SrcXmsHandle%, SrcOffset&, DestXmsHandle%,
  10572.             DestOffset&, NumBytes&)
  10573.  
  10574.             INPUT
  10575.  
  10576.             SrcXmsHandle - handle of source extended memory block
  10577.             SrcOffset - number of bytes from beginning of source memory
  10578.             block
  10579.             DestXmsHandle - handle of destination extended memory block
  10580.             DestOffset - number of bytes from beginning of destination
  10581.             memory block
  10582.             NumBytes - number of bytes to copy from source to destination
  10583.             (must be even)
  10584.  
  10585.             OUTPUT
  10586.  
  10587.             XMSCOPY returns a 1 if copy was successful, 0 otherwise.
  10588.  
  10589.             USAGE
  10590.  
  10591.             XMSCOPY copies the number of bytes specified in NumBytes from
  10592.             the source extended memory block to the destination extended
  10593.             memory block.  NumBytes must be an even number.  The copy may
  10594.             begin and/or end offset from the beginning of the source and
  10595.             destination blocks by passing non zero values in SrcOffset
  10596.             and/or DestOffset.  The copy will occur faster if both offsets
  10597.             are divisible by four.  If the copy was unsuccessful, check
  10598.             XMSERROR for error codes.
  10599.  
  10600.             SEE ALSO
  10601.  
  10602.             WHICHXMS, XMSALLOCATE, XMSERROR, XMSFREE, XMSGET, XMSPUT
  10603.  
  10604.             EXAMPLE
  10605.  
  10606.             REM THIS WILL COPY ONE ARRAY INTO ONE XMS BLOCK AND THEN COPY
  10607.             IT
  10608.             REM TO A DIFFERENT XMS BLOCK, AND THEN COPY THAT BACK INTO
  10609.             ANOTHER ARRAY
  10610.             $LINK "SVGAPB.PBL"
  10611.             $INCLUDE "SVGAPB.BI"
  10612.             DEFINT A-Z
  10613.  
  10614.             REM *DIMENSION OUR SOURCE AND DESTINATION ARRAYS*
  10615.             DIM TEST1(0 TO 9) AS INTEGER
  10616.             DIM TEST2(0 TO 9) AS INTEGER
  10617.             CLS
  10618.  
  10619.             REM *MAKE SURE XMS IS READY AND AVAILBLE*
  10620.             IF WHICHXMS(MEM, HANDLES) = 1 THEN
  10621.  
  10622.  
  10623.                                                                         170
  10624.  
  10625.  
  10626.  
  10627.  
  10628.  
  10629.                IF MEM < 1 OR HANDLES < 1 THEN
  10630.                  PRINT "SORRY...THERE IS EITHER NO FREE XMS MEMORY OR NO
  10631.             FREE XMS HANDLES"
  10632.                  END
  10633.                END IF
  10634.             ELSE
  10635.                PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  10636.                PRINT "MAKE SURE YOU HAVE A XMS MEMORY MANAGER (SUCH AS
  10637.             'HIMEM.SYS' INSTALLED)"
  10638.                END
  10639.             END IF
  10640.  
  10641.             REM *PUT SOME DATA INTO THE SOURCE ARRAY*
  10642.             FOR I = 0 TO 9
  10643.                TEST1(I) = I * 10
  10644.             NEXT I
  10645.  
  10646.             REM *ALLOCATE THE FIRST XMS MEMORY BLOCK*
  10647.             OurHandle1 = XMSALLOCATE(1)
  10648.             IF OurHandle1 = 0 THEN
  10649.                PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  10650.                PRINT "ERROR #"; XMSERROR
  10651.                ER = XMSFREE(OurHandle1)
  10652.                END
  10653.             END IF
  10654.  
  10655.             REM *ALLOCATE THE SECOND XMS MEMORY BLOCK*
  10656.             OurHandle2 = XMSALLOCATE(1)
  10657.             IF OurHandle2 = 0 THEN
  10658.                PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  10659.                PRINT "ERROR #"; XMSERROR
  10660.                ER = XMSFREE(OurHandle1)
  10661.                ER = XMSFREE(OurHandle2)
  10662.                END
  10663.             END IF
  10664.  
  10665.             REM *COPY OUR SOURCE ARRAY INTO OUR FIRST XMS BLOCK*
  10666.             I = XMSPUT(TEST1(0), OurHandle1, 0, 20)
  10667.             IF I = 0 THEN
  10668.                PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10669.             LIST..."
  10670.                PRINT "ERROR #"; XMSERROR
  10671.                ER = XMSFREE(OurHandle1)
  10672.                ER = XMSFREE(OurHandle2)
  10673.                END
  10674.             END IF
  10675.  
  10676.             REM *COPY THE FIRST XMS BLOCK TO THE SECOND XMS BLOCK*
  10677.             IF XMSCOPY(OurHandle1, 0, OurHandle2, 0, 20) = 0 THEN
  10678.                PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10679.             LIST..."
  10680.                PRINT "ERROR #"; XMSERROR
  10681.                ER = XMSFREE(OurHandle1)
  10682.                ER = XMSFREE(OurHandle2)
  10683.  
  10684.  
  10685.                                                                         171
  10686.  
  10687.  
  10688.  
  10689.  
  10690.  
  10691.                END
  10692.             END IF
  10693.  
  10694.             REM *COPY DATA FROM THE SECOND XMS BLOCK TO OUR DESTINATION
  10695.             ARRAY*
  10696.             IF XMSGET(OurHandle2, 0, TEST2(0), 20) = 0 THEN
  10697.                PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10698.             LIST..."
  10699.                PRINT "ERROR #"; ER
  10700.                ER = XMSFREE(OurHandle1)
  10701.                ER = XMSFREE(OurHandle2)
  10702.                END
  10703.             END IF
  10704.  
  10705.             REM *FREE THE XMS BLOCKS WE HAVE ALLOCATED*
  10706.             ER = XMSFREE(OurHandle1)
  10707.             ER = XMSFREE(OurHandle2)
  10708.  
  10709.             REM *SHOW THE RESULTS*
  10710.             PRINT "OK...WE INITILIZED ONE ARRAY,PUT A COPY OF IT INTO
  10711.             XMS,"
  10712.             PRINT "THEN WE COPIED THAT XMS BLOCK TO ANOTHER XMS BLOCK,
  10713.             AND"
  10714.             PRINT "THEN PUT A COPY OF THE SECOND XMS BLOCK INTO A NEW
  10715.             ARRAY;"
  10716.             PRINT "HERE ARE THE RESULTS:"
  10717.             PRINT
  10718.             PRINT "SOURCE ARRAY", , "DESTINATION ARRAY"
  10719.             FOR I = 0 TO 9
  10720.                PRINT TEST1(I), , TEST2(I)
  10721.             NEXT I
  10722.             END
  10723.  
  10724.  
  10725.  
  10726.  
  10727.  
  10728.  
  10729.  
  10730.  
  10731.  
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.                                                                         172
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.           XMSERROR
  10754.  
  10755.             PROTOTYPE
  10756.  
  10757.             FUNCTION XMSERROR% ()
  10758.  
  10759.             INPUT
  10760.  
  10761.             no input parameters
  10762.  
  10763.             OUTPUT
  10764.  
  10765.             XMSERROR returns the error code from the most recent XMS
  10766.             function call.
  10767.  
  10768.             USAGE
  10769.  
  10770.             XMSERROR returns the error code from the most recent XMS
  10771.             function call.  Each XMS function resets the error code to
  10772.             zero.  Therefore, if there has been an error, the error code
  10773.             should be checked immediately.  The error code will be one of
  10774.             the following:
  10775.  
  10776.             0    no error
  10777.             1    WHICHXMS has not been
  10778.                  called
  10779.             2    number of bytes to
  10780.                  copy is zero
  10781.             3    number of bytes to
  10782.                  copy is odd
  10783.             4    offset into XMS block
  10784.                  is zero
  10785.             128  Function not
  10786.                  implemented
  10787.             129  VDISK device driver
  10788.                  was detected
  10789.             142  General driver error
  10790.             143  Unrecoverable driver
  10791.                  error
  10792.             146  DX is less than
  10793.                  /HMAMIN= parameter
  10794.             160  All extended memory is
  10795.                  allocated
  10796.             161  XMM handles are
  10797.                  exhausted
  10798.             162  Handle is invalid
  10799.             163  Source handle is
  10800.                  invalid
  10801.             164  Source offset is
  10802.                  invalid
  10803.             165  Destination handle is
  10804.                  invalid
  10805.             166  Destination offset is
  10806.                  invalid
  10807.  
  10808.  
  10809.                                                                         173
  10810.  
  10811.  
  10812.  
  10813.  
  10814.  
  10815.             167  Length is invalid
  10816.             168  Overlap in move
  10817.                  request is invalid
  10818.             169  Parity error detected
  10819.             171  Block locked
  10820.  
  10821.             SEE ALSO
  10822.  
  10823.             WHICHXMS, XMSALLOCATE, XMSBLKGET, XMSBLKPUT, XMSCOPY, XMSFREE,
  10824.             XMSGET, XMSPUT, XMSSCREENGET, XMSSCREENPUT
  10825.  
  10826.             EXAMPLE
  10827.  
  10828.             See XMSCOPY
  10829.  
  10830.  
  10831.  
  10832.  
  10833.  
  10834.  
  10835.  
  10836.  
  10837.  
  10838.  
  10839.  
  10840.  
  10841.  
  10842.  
  10843.  
  10844.  
  10845.  
  10846.  
  10847.  
  10848.  
  10849.  
  10850.  
  10851.  
  10852.  
  10853.  
  10854.  
  10855.  
  10856.  
  10857.  
  10858.  
  10859.  
  10860.  
  10861.  
  10862.  
  10863.  
  10864.  
  10865.  
  10866.  
  10867.  
  10868.  
  10869.  
  10870.  
  10871.                                                                         174
  10872.  
  10873.  
  10874.  
  10875.  
  10876.  
  10877.           XMSFREE
  10878.  
  10879.             PROTOTYPE
  10880.  
  10881.             FUNCTION XMSFREE% (XmsHandle%)
  10882.  
  10883.             INPUT
  10884.  
  10885.             XmsHandle - handle of extended memory block to free
  10886.  
  10887.             OUTPUT
  10888.  
  10889.             XMSFREE returns 1 if extended memory block was deallocated, 0
  10890.             otherwise.
  10891.  
  10892.             USAGE
  10893.  
  10894.             XMSFREE deallocates the specified extended memory block.  All
  10895.             allocated blocks must be freed before a program terminates or
  10896.             the memory is lost until the machine is rebooted.  Simply
  10897.             exiting a program will not free allocated extended memory
  10898.             blocks.  If the function was unsuccessful, check XMSERROR for
  10899.             error codes.
  10900.  
  10901.             SEE ALSO
  10902.  
  10903.             WHICHXMS, XMSALLOCATE, XMSBLKGET, XMSBLKPUT, XMSCOPY,
  10904.             XMSERROR, XMSGET, XMSPUT, XMSSCREENGET, XMSSCREENPUT
  10905.  
  10906.             EXAMPLE
  10907.  
  10908.             See XMSCOPY
  10909.  
  10910.  
  10911.  
  10912.  
  10913.  
  10914.  
  10915.  
  10916.  
  10917.  
  10918.  
  10919.  
  10920.  
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.  
  10927.  
  10928.  
  10929.  
  10930.  
  10931.  
  10932.  
  10933.                                                                         175
  10934.  
  10935.  
  10936.  
  10937.  
  10938.  
  10939.           XMSGET
  10940.  
  10941.             PROTOTYPE
  10942.  
  10943.             FUNCTION XMSGET% (SrcXmsHandle%, SrcOffset&, DestVariable%,
  10944.             NumBytes&)
  10945.  
  10946.             INPUT
  10947.  
  10948.             SrcXmsHandle - handle of source extended memory block
  10949.             SrcOffset - number of bytes from beginning of source memory
  10950.             block
  10951.             NumBytes - number of bytes to copy from extended memory to
  10952.             conventional memory (must be even)
  10953.  
  10954.             OUTPUT
  10955.  
  10956.             XMSGET returns 0 if the copy was successful, an error code
  10957.             otherwise.
  10958.             DestVariable - integer variable or array holding copied data
  10959.  
  10960.             USAGE
  10961.  
  10962.             XMSGET retrieves data from extended memory and places it in
  10963.             conventional memory.  The number of bytes copied must be an
  10964.             even number and cannot be larger than 65536.  The copy may
  10965.             begin off the beginning of the source extended memory block by
  10966.             specifying a non zero SrcOffset.  If the function was
  10967.             unsuccessful, check XMSERROR for error codes.
  10968.  
  10969.             SEE ALSO
  10970.  
  10971.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSPUT
  10972.  
  10973.             EXAMPLE
  10974.  
  10975.             See XMSCOPY
  10976.  
  10977.  
  10978.  
  10979.  
  10980.  
  10981.  
  10982.  
  10983.  
  10984.  
  10985.  
  10986.  
  10987.  
  10988.  
  10989.  
  10990.  
  10991.  
  10992.  
  10993.  
  10994.  
  10995.                                                                         176
  10996.  
  10997.  
  10998.  
  10999.  
  11000.  
  11001.           XMSPUT
  11002.  
  11003.             PROTOTYPE
  11004.  
  11005.             FUNCTION XMSPUT% (SrcVariable%, DestXmsHandle%, DestOffset&,
  11006.             NumBytes&)
  11007.  
  11008.             INPUT
  11009.  
  11010.             SrcVariable - source variable or array in conventional memory
  11011.             DestXmsHandle - handle of destination extended memory block
  11012.             DestOffset - number of bytes from beginning of destination
  11013.             memory block
  11014.             NumBytes - number of bytes to copy from conventional memory to
  11015.             extended memory (must be even)
  11016.  
  11017.             OUTPUT
  11018.  
  11019.             XMSPUT returns 1 if the copy was successful, 0 otherwise.
  11020.  
  11021.             USAGE
  11022.  
  11023.             XMSPUT copies data from conventional memory to extended
  11024.             memory.  The number of bytes copied must be an even number and
  11025.             cannot be larger than 65536.  The destination may begin off
  11026.             the beginning of the extended memory block by specifying a non
  11027.             zero DestOffset.  If the function was unsuccessful, check
  11028.             XMSERROR for error codes.
  11029.  
  11030.             SEE ALSO
  11031.  
  11032.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET
  11033.  
  11034.             EXAMPLE
  11035.  
  11036.             See XMSCOPY
  11037.  
  11038.  
  11039.  
  11040.  
  11041.  
  11042.  
  11043.  
  11044.  
  11045.  
  11046.  
  11047.  
  11048.  
  11049.  
  11050.  
  11051.  
  11052.  
  11053.  
  11054.  
  11055.  
  11056.  
  11057.                                                                         177
  11058.  
  11059.  
  11060.  
  11061.  
  11062.  
  11063.           XMSSCREENGET
  11064.  
  11065.             PROTOTYPE
  11066.  
  11067.             FUNCTION XMSSCREENGET ( )
  11068.  
  11069.             INPUT
  11070.  
  11071.             no input parameters
  11072.  
  11073.             OUTPUT
  11074.  
  11075.             Used as a function, XMSSCREENGET returns the assigned XMS
  11076.             memory handle if successful, 0 if it otherwise.
  11077.  
  11078.             USAGE
  11079.  
  11080.             XMSSCREENGET stores the pixel data contained within the entire
  11081.             active screen.  The bitmap is stored such that the first
  11082.             integer in the allocated XMS block is the width and the second
  11083.             integer is the height.  These are followed by a long integer
  11084.             (4 bytes) that specifies the total size of the allocated XMS
  11085.             block.  The remaining bytes are the bitmap raster data stored
  11086.             by rows starting at the top of the screen.  Note that this
  11087.             function is about twice as fast as using XMSBLKGET to save the
  11088.             entire screen.  If the function was unsuccessful, check
  11089.             XMSERROR for error codes.
  11090.  
  11091.             All allocated XMS blocks must be freed using XMSFREE before a
  11092.             program terminates or the memory is lost until the machine is
  11093.             rebooted.  Simply exiting a program will not free allocated
  11094.             extended memory blocks.
  11095.  
  11096.             SEE ALSO
  11097.  
  11098.             BLKGET, BLKPUT, XMSBLKGET, XMSBLKPUT, XMSERROR, XMSFREE,
  11099.             XMSSCREENPUT
  11100.  
  11101.             EXAMPLE
  11102.  
  11103.             REM THIS WILL SAVE THE ENTIRE SCREEN IN XMS MSMORY
  11104.             $LINK "SVGAPB.PBL"
  11105.             $INCLUDE "SVGAPB.BI"
  11106.             DEFINT A-Z
  11107.  
  11108.             CLS
  11109.             IF WHICHXMS(MEM, HANDLES) = 1 THEN
  11110.                IF MEM < 1 OR HANDLES < 1 THEN
  11111.                  PRINT "SORRY...THERE IS EITHER NO FREE XMS MEMORY OR NO
  11112.             FREE XMS HANDLES"
  11113.                  END
  11114.                END IF
  11115.             ELSE
  11116.                PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  11117.  
  11118.  
  11119.                                                                         178
  11120.  
  11121.  
  11122.  
  11123.  
  11124.  
  11125.                PRINT "MAKE SURE YOU HAVE A XMS MEMORY MANAGER (SUCH AS
  11126.             'HIMEM.SYS' INSTALLED)"
  11127.                END
  11128.             END IF
  11129.             IF WHICHVGA = 0 THEN
  11130.                PRINT "CAN'T ID VIDEO CARD"
  11131.                END
  11132.             END IF
  11133.             DUMMY = RES640
  11134.             DRWFILLBOX 1, 10, 0, 0, GETMAXX, GETMAXY
  11135.             FOR I = 0 TO 200
  11136.                X1 = RND * GETMAXX
  11137.                Y1 = RND * GETMAXY
  11138.                X2 = RND * GETMAXX
  11139.                Y2 = RND * GETMAXY
  11140.                C = RND * 16
  11141.                DRWLINE 1, C, X1, Y1, X2, Y2
  11142.             NEXT I
  11143.             DRWBOX 1, 15, 0, 0, GETMAXX, GETMAXY
  11144.             REM *ALLOCATE A BLOCK OF XMS MEMORY*
  11145.             OurHandle = XMSSCREENGET
  11146.             IF OurHandle = 0 THEN
  11147.                DUMMY = RESTEXT
  11148.                DUMMY = XMSFREE(OurHandle)
  11149.                PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  11150.                END
  11151.             END IF
  11152.             FILLSCREEN 0
  11153.             DRWSTRING 1, 10, 0, "PRESS A KEY...", 0, 0
  11154.             WHILE INKEY$ = ""
  11155.             WEND
  11156.             ER = XMSSCREENPUT(OurHandle)
  11157.             DUMMY = XMSFREE(OurHandle)
  11158.             WHILE INKEY$ = ""
  11159.             WEND
  11160.             DUMMY = RESTEXT
  11161.             END
  11162.  
  11163.  
  11164.  
  11165.  
  11166.  
  11167.  
  11168.  
  11169.  
  11170.  
  11171.  
  11172.  
  11173.  
  11174.  
  11175.  
  11176.  
  11177.  
  11178.  
  11179.  
  11180.  
  11181.                                                                         179
  11182.  
  11183.  
  11184.  
  11185.  
  11186.  
  11187.           XMSSCREENPUT
  11188.  
  11189.             PROTOTYPE
  11190.  
  11191.             FUNCTION XMSSCREENPUT (SrcXmsHandle%)
  11192.  
  11193.             INPUT
  11194.  
  11195.             SrcXmsHandle - handle of source extended memory block
  11196.  
  11197.             OUTPUT
  11198.  
  11199.             Used as a function, XMSSCREENPUT returns a 1 if successful, 0
  11200.             otherwise.
  11201.  
  11202.             USAGE
  11203.  
  11204.             XMSSCREENPUT places the complete screen pixel data contained
  11205.             in xms memory referenced by SrcXmsHandle on the screen.  The
  11206.             current screen resolution must be the same as the saved screen
  11207.             resolution.  This function is not bound by the current
  11208.             viewport.  If the function was unsuccessful, check XMSERROR
  11209.             for error codes.
  11210.  
  11211.             SEE ALSO
  11212.  
  11213.             BLKGET, BLKPUT, XMSBLKGET, XMSBLKPUT, XMSERROR, XMSFREE,
  11214.             XMSSCREENGET
  11215.  
  11216.             EXAMPLE
  11217.  
  11218.             See XMSSCREENGET
  11219.  
  11220.  
  11221.  
  11222.  
  11223.  
  11224.  
  11225.  
  11226.  
  11227.  
  11228.  
  11229.  
  11230.  
  11231.  
  11232.  
  11233.  
  11234.  
  11235.  
  11236.  
  11237.  
  11238.  
  11239.  
  11240.  
  11241.  
  11242.  
  11243.                                                                         180
  11244.  
  11245.  
  11246.  
  11247.  
  11248.  
  11249.           APPENDIX A.  SVGAPB.BI
  11250.  
  11251.           This is the header file containing function declarations and
  11252.           structure definitions for SVGAPB.PBL.  This file should be
  11253.           included in every program that uses this library.  To properly
  11254.           include the header file, place the following line at the top of
  11255.           the every program module:
  11256.  
  11257.                                 $INCLUDE "SVGAPB.BI"
  11258.  
  11259.           Without these declarations and definitions, the Power Basic
  11260.           compiler will be unable to compile any program using the commands
  11261.           found in this library.
  11262.  
  11263.           REM SVGAPB GRAPHICS LIBRARY INCLUDE FILE FOR USE WITH
  11264.           REM POWERBASIC INC.'S POWER BASIC 3.00c AND LATER
  11265.           REM COPYRIGHT 1993-1995 BY STEPHEN L. BALKUM AND DANIEL A. SILL
  11266.           REM ZEPHYR SOFTWARE P.O. BOX 7704, AUSTIN, TEXAS  78713-7704
  11267.           REM LAST UPDATE 1/1/95
  11268.  
  11269.           TYPE P2DType
  11270.             X AS INTEGER
  11271.             Y AS INTEGER
  11272.           END TYPE
  11273.  
  11274.             TYPE P3Dtype
  11275.             X AS INTEGER
  11276.             Y AS INTEGER
  11277.             Z AS INTEGER
  11278.           END TYPE
  11279.  
  11280.           TYPE PROJType
  11281.             EYEX AS INTEGER
  11282.             EYEY AS INTEGER
  11283.             EYEZ AS INTEGER
  11284.             SCRD AS INTEGER
  11285.             THETA AS INTEGER
  11286.             PHI AS INTEGER
  11287.           END TYPE
  11288.  
  11289.           TYPE RGBType
  11290.             R AS BYTE
  11291.             G AS BYTE
  11292.             B AS BYTE
  11293.           END TYPE
  11294.  
  11295.           DECLARE SUB BLKGET (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%,
  11296.           SEG GfxBlk%)
  11297.           DECLARE SUB BLKPUT (BYVAL Mode%, BYVAL X%, BYVAL Y%, SEG GfxBlk%)
  11298.           DECLARE SUB BLKRESIZE (BYVAL X%, BYVAL Y%, SEG SourceGfxBlk%, SEG
  11299.           DestGfxBlk%)
  11300.           DECLARE FUNCTION BLKROTATE% (BYVAL Ang%, BYVAL BackFill%, SEG
  11301.           SourceGfxBlk%, SEG DestGfxBlk%)
  11302.           DECLARE FUNCTION BLKROTATESIZE& (BYVAL Ang%, SEG SourceGfxBlk%)
  11303.  
  11304.  
  11305.                                                                         181
  11306.  
  11307.  
  11308.  
  11309.  
  11310.  
  11311.           DECLARE SUB BYTECOPY (SEG SourceArray%, SEG DestArray%, BYVAL
  11312.           NumOfBytes&)
  11313.           DECLARE SUB D2ROTATE (BYVAL Points%, BYVAL XOrigin%, BYVAL
  11314.           YOrigin%, BYVAL Ang%, SEG InAry%, SEG OutAry%)
  11315.           DECLARE SUB D2SCALE (BYVAL Points%, BYVAL XSCALE%, BYVAL YSCALE%,
  11316.           SEG InAry%, SEG OutAry%)
  11317.           DECLARE SUB D2TRANSLATE (BYVAL Points%, BYVAL XTRANS%, BYVAL
  11318.           YTRANS%, SEG InAry%, SEG OutAry%)
  11319.           DECLARE FUNCTION D3PROJECT% (BYVAL Points%, SEG ProjParms%, SEG
  11320.           InAry%, SEG OutAry%)
  11321.           DECLARE SUB D3ROTATE (BYVAL Points%, BYVAL XOrigin%, BYVAL
  11322.           YOrigin%, BYVAL ZOrigin%, BYVAL ZRAng%, BYVAL YRAng%, BYVAL
  11323.           XRAng%, SEG InAry%, SEG OutAry%)
  11324.           DECLARE SUB D3SCALE (BYVAL Points%, BYVAL XSCALE%, BYVAL YSCALE%,
  11325.           BYVAL ZScale%, SEG InAry%, SEG OutAry%)
  11326.           DECLARE SUB D3TRANSLATE (BYVAL Points%, BYVAL XTRANS%, BYVAL
  11327.           YTRANS%, BYVAL ZTrans%, SEG InAry%, SEG OutAry%)
  11328.           DECLARE SUB DRWALINE (BYVAL ColrBits%, BYVAL Colr%, BYVAL X1%,
  11329.           BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  11330.           DECLARE SUB DRWBOX (BYVAL Mode%, BYVAL Colr%, BYVAL X1%, BYVAL
  11331.           Y1%, BYVAL X2%, BYVAL Y2%)
  11332.           DECLARE SUB DRWCIRARC (BYVAL Mode%, BYVAL Colr%, BYVAL CenterX%,
  11333.           BYVAL CenterY%, BYVAL Radius%, BYVAL StartAng&, BYVAL EndAng&)
  11334.           DECLARE SUB DRWCIRCLE (BYVAL Mode%, BYVAL Colr%, BYVAL CenterX%,
  11335.           BYVAL CenterY%, BYVAL Radius%)
  11336.           DECLARE SUB DRWCUBICBEZIER (BYVAL Mode%, BYVAL Colr%, SEG Pon1%,
  11337.           SEG Poff1%, SEG Poff2%, SEG Pon2%)
  11338.           DECLARE SUB DRWELLARC (BYVAL Mode%, BYVAL Colr%, BYVAL CenterX%,
  11339.           BYVAL CenterY%, BYVAL RadiusX%, BYVAL RadiusY%, BYVAL StartAng&,
  11340.           BYVAL EndAng&)
  11341.           DECLARE SUB DRWELLIPSE (BYVAL Mode%, BYVAL Colr%, BYVAL CenterX%,
  11342.           BYVAL CenterY%, BYVAL Radiusx%, BYVAL Radiusy%)
  11343.           DECLARE SUB DRWFILLBOX (BYVAL Mode%, BYVAL Colr%, BYVAL X1%,
  11344.           BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  11345.           DECLARE SUB DRWFILLCIRCLE (BYVAL Mode%, BYVAL Colr%, BYVAL
  11346.           CenterX%, BYVAL CenterY%, BYVAL Radius%)
  11347.           DECLARE SUB DRWFILLELLIPSE (BYVAL Mode%, BYVAL Colr%, BYVAL
  11348.           CenterX%, BYVAL CenterY%, BYVAL Radiusx%, BYVAL Radiusy%)
  11349.           DECLARE SUB DRWLINE (BYVAL Mode%, BYVAL Colr%, BYVAL X1%, BYVAL
  11350.           Y1%, BYVAL X2%, BYVAL Y2%)
  11351.           DECLARE SUB DRWPOINT (BYVAL Mode%, BYVAL Colr%, BYVAL X%, BYVAL
  11352.           Y%)
  11353.           DECLARE SUB DRWSTRING (BYVAL Mode%, BYVAL FColr%, BYVAL BColr%,
  11354.           Strng$, BYVAL X%, BYVAL Y%)
  11355.           DECLARE SUB DRWSTRINGDN (BYVAL Mode%, BYVAL FColr%, BYVAL BColr%,
  11356.           Strng$, BYVAL X%, BYVAL Y%)
  11357.           DECLARE SUB DRWSTRINGLT (BYVAL Mode%, BYVAL FColr%, BYVAL BColr%,
  11358.           Strng$, BYVAL X%, BYVAL Y%)
  11359.           DECLARE SUB DRWSTRINGRT (BYVAL Mode%, BYVAL FColr%, BYVAL BColr%,
  11360.           Strng$, BYVAL X%, BYVAL Y%)
  11361.           DECLARE SUB FILLAREA (BYVAL Xseed%, BYVAL Yseed%, BYVAL
  11362.           BorderColr%, BYVAL FillColr%)
  11363.           DECLARE SUB FILLCOLOR (BYVAL Xseed%, BYVAL Yseed%, BYVAL
  11364.           OldColr%, BYVAL NewColr%)
  11365.  
  11366.  
  11367.                                                                         182
  11368.  
  11369.  
  11370.  
  11371.  
  11372.  
  11373.           DECLARE SUB FILLCONVEXPOLY (BYVAL Colr%, BYVAL Points%, SEG
  11374.           InAry%)
  11375.           DECLARE SUB FILLPOLY (BYVAL Colr%, BYVAL Points%, SEG InAry%)
  11376.           DECLARE SUB FILLSCREEN (BYVAL Colr AS INTEGER)
  11377.           DECLARE SUB FILLPAGE (BYVAL Colr%)
  11378.           DECLARE SUB FILLVIEW (BYVAL Colr%)
  11379.           DECLARE SUB FONTGETINFO (SEG WDTH%, SEG HGHT%)
  11380.           DECLARE SUB FONTSET (SEG FONT?)
  11381.           DECLARE SUB FONTSYSTEM ()
  11382.           DECLARE FUNCTION GETARCCOS% (BYVAL Value&)
  11383.           DECLARE FUNCTION GETARCSIN% (BYVAL Value&)
  11384.           DECLARE FUNCTION GETARCTAN% (BYVAL Value&)
  11385.           DECLARE FUNCTION GETCOS& (BYVAL Ang&)
  11386.           DECLARE FUNCTION GETSIN& (BYVAL Ang&)
  11387.           DECLARE FUNCTION GETTAN& (BYVAL Ang&)
  11388.           DECLARE FUNCTION GETSQRT& (BYVAL Number&)
  11389.           DECLARE FUNCTION GETMAXX% ()
  11390.           DECLARE FUNCTION GETMAXY% ()
  11391.           DECLARE SUB GETLASTSTRING (SEG StrngGfxBlk%)
  11392.           DECLARE FUNCTION GETPOINT% (BYVAL X%, BYVAL Y%)
  11393.           DECLARE SUB JOYSTICKINFO (SEG JAX%, SEG JAY%, SEG JAButs%, SEG
  11394.           JBX%, SEG JBY%, SEG JBButs%)
  11395.           DECLARE SUB MOUSEBUTPRESS (BYVAL ReqBut%, SEG Xloc%, SEG Yloc%,
  11396.           SEG Num%, SEG MButs%)
  11397.           DECLARE SUB MOUSEBUTRELEASE (BYVAL ReqBut%, SEG Xloc%, SEG Yloc%,
  11398.           SEG Num%, SEG MButs%)
  11399.           DECLARE SUB MOUSECURSORDEFAULT ()
  11400.           DECLARE SUB MOUSECURSORSET (SEG MouseCursor?)
  11401.           DECLARE SUB MOUSEENTER ()
  11402.           DECLARE SUB MOUSEEXIT ()
  11403.           DECLARE SUB MOUSEHIDE ()
  11404.           DECLARE SUB MOUSEINFO (SEG DrvMajorVer%, SEG DrvMinorVer%, SEG
  11405.           MouseType%, SEG IRQnumber%)
  11406.           DECLARE SUB MOUSELOCSET (BYVAL Xloc%, BYVAL Yloc%)
  11407.           DECLARE SUB MOUSERANGESET (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  11408.           Y2%)
  11409.           DECLARE SUB MOUSERESTORESTATE (SEG MouseBuf?)
  11410.           DECLARE SUB MOUSESAVESTATE (SEG MouseBuf?)
  11411.           DECLARE SUB MOUSESENSSET (BYVAL Xsens%, BYVAL Ysens%,BYVAL
  11412.           DblSpedThrshold%)
  11413.           DECLARE SUB MOUSESHOW ()
  11414.           DECLARE SUB MOUSESTATUS (SEG X%, SEG Y%, SEG MButs%)
  11415.           DECLARE FUNCTION MOUSESTORAGESIZE% ()
  11416.           DECLARE SUB OVERSCANSET (BYVAL Colr%)
  11417.           DECLARE FUNCTION PAGEDISPLAY% (BYVAL X%, BYVAL Y%, BYVAL Page%)
  11418.           DECLARE FUNCTION PAGEACTIVE% (BYVAL Page%)
  11419.           DECLARE SUB PALCHGAUTO (SEG Pal AS RGBType, SEG NewPal AS
  11420.           RGBType, BYVAL FirstColr%, BYVAL LastColr%, BYVAL Speed%)
  11421.           DECLARE SUB PALCHGSTEP (SEG Pal AS RGBType, SEG NewPal AS
  11422.           RGBType, BYVAL FirstColr%, BYVAL LastColr%, BYVAL Percent%)
  11423.           DECLARE SUB PALCOPY (SEG SourcePal AS RGBType, SEG DestPal AS
  11424.           RGBType, BYVAL FirstColr%, BYVAL LastColr%)
  11425.           DECLARE SUB PALDIMSTEP (SEG Pal AS RGBType, BYVAL FirstColr%,
  11426.           BYVAL LastColr%, BYVAL Percent%)
  11427.  
  11428.  
  11429.                                                                         183
  11430.  
  11431.  
  11432.  
  11433.  
  11434.  
  11435.           DECLARE SUB PALGET (SEG Pal AS RGBType, BYVAL FirstColr%, BYVAL
  11436.           LastColr%)
  11437.           DECLARE SUB PALIOAUTO (SEG Pal AS RGBType, BYVAL FirstColr%,
  11438.           BYVAL LastColr%, BYVAL Speed%)
  11439.           DECLARE SUB PALROTATE (SEG Pal AS RGBType, BYVAL FirstColr%,
  11440.           BYVAL LastColr%, BYVAL ColShift%)
  11441.           DECLARE SUB PALSET (SEG Pal AS RGBType, BYVAL FirstColr%, BYVAL
  11442.           LastColr%)
  11443.           DECLARE FUNCTION PCXMAKE% (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  11444.           Y2%,SEG FileName$)
  11445.           DECLARE FUNCTION PCXGETINFO% (SEG FileName$, SEG GifXSize%, SEG
  11446.           GifYSize%, SEG NumColors%, Pal AS RGBType)
  11447.           DECLARE FUNCTION PCXPUT% (BYVAL Mode%, BYVAL Xloc%, BYVAL Yloc%,
  11448.           SEG FileName$)
  11449.           DECLARE FUNCTION RES320% ()
  11450.           DECLARE FUNCTION RES640L% ()
  11451.           DECLARE FUNCTION RES640% ()
  11452.           DECLARE FUNCTION RES800% ()
  11453.           DECLARE FUNCTION RES1024% ()
  11454.           DECLARE FUNCTION RES1280% ()
  11455.           DECLARE FUNCTION RESTEXT% ()
  11456.           DECLARE SUB SCROLLDN (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%,
  11457.           BYVAL Num%, BYVAL Colr%)
  11458.           DECLARE SUB SCROLLLT (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%,
  11459.           BYVAL Num%, BYVAL Colr%)
  11460.           DECLARE SUB SCROLLRT (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%,
  11461.           BYVAL Num%, BYVAL Colr%)
  11462.           DECLARE SUB SCROLLUP (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%,
  11463.           BYVAL Num%, BYVAL Colr%)
  11464.           DECLARE SUB SDELAY (BYVAL Count%)
  11465.           DECLARE SUB SETCARD (BYVAL CHIP%, BYVAL MEM%)
  11466.           DECLARE SUB SETVIEW (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  11467.           DECLARE SUB SPRITEGAP (BYVAL TransColr%, BYVAL X%, BYVAL Y%, SEG
  11468.           SpriteGfxBlk%, SEG BkgndGfxBlk%)
  11469.           DECLARE SUB SPRITEGET (BYVAL TransColr%, BYVAL X%, BYVAL Y%, SEG
  11470.           SpriteGfxBlk%, SEG BkgndGfxBlk%)
  11471.           DECLARE SUB SPRITEPUT (BYVAL Mode%, BYVAL TransColr%, BYVAL X%,
  11472.           BYVAL Y%, SEG SpriteGfxBlk%)
  11473.           DECLARE FUNCTION SPRITECOLLDETECT% (BYVAL TransColr%, BYVAL
  11474.           Sprite1LocX%, BYVAL Sprite1LocY%, BYVAL Sprite2LocX%, BYVAL
  11475.           Sprite2LocY%, SEG Sprite1GfxBlk%, SEG Sprite2GfxBlk%)
  11476.           DECLARE FUNCTION VIDEOMODEGET% ()
  11477.           DECLARE SUB VIDEOMODESET (BYVAL Mode%)
  11478.           DECLARE SUB VIDEOOFF ()
  11479.           DECLARE SUB VIDEOON ()
  11480.           DECLARE FUNCTION WHICHCPU% ()
  11481.           DECLARE FUNCTION WHICHJOYSTICK% ()
  11482.           DECLARE FUNCTION WHICHMEM% ()
  11483.           DECLARE FUNCTION WHICHMOUSE% ()
  11484.           DECLARE FUNCTION WHICHVGA% ()
  11485.           DECLARE FUNCTION WHICHXMS% (SEG XmsKbytesAvailable%, SEG
  11486.           XmsHandlesAvailable%)
  11487.           DECLARE FUNCTION XMSALLOCATE% (BYVAL ReqKbytesOfMem%)
  11488.  
  11489.  
  11490.  
  11491.                                                                         184
  11492.  
  11493.  
  11494.  
  11495.  
  11496.  
  11497.           DECLARE FUNCTION XMSBLKGET% (BYVAL X1%, BYVAL Y1%, BYVAL X2%,
  11498.           BYVAL Y2%)
  11499.           DECLARE FUNCTION XMSBLKPUT% (BYVAL Mode%, BYVAL X%, BYVAL Y%,
  11500.           BYVAL XmsHandle%)
  11501.           DECLARE FUNCTION XMSCOPY% (BYVAL XmsHandle1%, BYVAL
  11502.           OffsetIntoXms1&, BYVAL XmsHandle2%, BYVAL OffsetIntoXms2&, BYVAL
  11503.           NumOfBytes&)
  11504.           DECLARE FUNCTION XMSERROR% ()
  11505.           DECLARE FUNCTION XMSFREE% (BYVAL XmsHandle%)
  11506.           DECLARE FUNCTION XMSGET% (BYVAL XmsHandle%, BYVAL OffsetIntoXms&,
  11507.           SEG DestVar%, BYVAL NumOfBytes&)
  11508.           DECLARE FUNCTION XMSPUT% (SEG SourceVar%, BYVAL XmsHandle%, BYVAL
  11509.           OffsetIntoXms&, BYVAL NumOfBytes&)
  11510.           DECLARE FUNCTION XMSSCREENGET% ()
  11511.           DECLARE FUNCTION XMSSCREENPUT% (BYVAL XmsHandle%)
  11512.  
  11513.  
  11514.  
  11515.  
  11516.  
  11517.  
  11518.  
  11519.  
  11520.  
  11521.  
  11522.  
  11523.  
  11524.  
  11525.  
  11526.  
  11527.  
  11528.  
  11529.  
  11530.  
  11531.  
  11532.  
  11533.  
  11534.  
  11535.  
  11536.  
  11537.  
  11538.  
  11539.  
  11540.  
  11541.  
  11542.  
  11543.  
  11544.  
  11545.  
  11546.  
  11547.  
  11548.  
  11549.  
  11550.  
  11551.  
  11552.  
  11553.                                                                         185
  11554.  
  11555.  
  11556.  
  11557.  
  11558.  
  11559.           APPENDIX B.  JOYSTICK PORTS AND Y-CABLES
  11560.  
  11561.           SCHEMATIC WIRING DIAGRAM FOR A STANDARD JOYSTICK PORT
  11562.  
  11563.                                     DB15 male
  11564.                                     connector
  11565.                    Joystick B            ___       Joystick A
  11566.                                       __/   |
  11567.                                      /    o | 1 -------------------+
  11568.              +------------------  9 | o     |     ___Button A      |
  11569.              |     Button A___      |     o | 2 --o o-+            |
  11570.              |           +-o o-- 10 | o     |         |    X Axis  |
  11571.              |  X Axis   |          |     o | 3 -------------+     |
  11572.              |     +------------ 11 | o     |         |      |     |
  11573.              |     |     |          |     o | 4 ------+      |     |
  11574.              +--/\/\/\   +------ 12 | o     |         |    /\/\/\--+
  11575.              |           |          |     o | 5       |            |
  11576.              |     +------------ 13 | o     |         |            |
  11577.              |     |     | ___      |     o | 6 -------------+     |
  11578.              |     |     +-o o-- 14 | o     |     ___ |      |     |
  11579.              |     |    Button B    |     o | 7 --o o-+      |     |
  11580.              |     |             15 | o     |   Button B   /\/\/\--+
  11581.              +--/\/\/\               \__  o | 8            Y Axis
  11582.                Y Axis                   \___|
  11583.  
  11584.           Notes:
  11585.  
  11586.           1)This diagram comes with NO warranties expressed or implied.
  11587.             It is provided for information only.  In no event shall
  11588.             Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  11589.             liable for damages resulting from use, misuse, or inability to
  11590.             use this information.
  11591.  
  11592.           2)The x and y axis potentiometers have a typical range of 0 to
  11593.             100k ohms.  Buttons are normally open and close when pressed.
  11594.  
  11595.           3)This diagram is correct for joystick ports that conform to the
  11596.             standard set forth by IBM. Some specialty joystick cards
  11597.             provide separate A and B joystick connectors.  For these
  11598.             cards, both connectors are wired to pins 1 through 8 as shown
  11599.             in the diagram.
  11600.  
  11601.           4)Many 'Super I/O' boards (2H/2F/2S/1P/1G) equipped with a
  11602.             joystick port will support only one joystick.  On these cards,
  11603.             pins 9 through 15 are not used.
  11604.  
  11605.           5)Commercially available joysticks are wired to use pins 1
  11606.             through 8 and, therefore, will always be 'Joystick A' if
  11607.             plugged directly into a dual joystick port connector.
  11608.  
  11609.           6)Many sound cards provide joystick ports; however, their
  11610.             connector wiring does not always conform to the standard shown
  11611.             above.  Some of these connectors may be used for other
  11612.  
  11613.  
  11614.  
  11615.                                                                         186
  11616.  
  11617.  
  11618.  
  11619.  
  11620.  
  11621.             purposes such as a MIDI port.  See the documentation that
  11622.             comes with the sound card.
  11623.  
  11624.           7)If there is more than one joystick port on a computer
  11625.             configured to operate the same joystick, only ONE port should
  11626.             be enabled at any given time for proper operation.  Disable
  11627.             all but one joystick port.  For example, if the computer has
  11628.             both a Super I/O card and a sound card, the joystick port on
  11629.             the Super I/O card should be disabled since the sound card's
  11630.             port probably supports two joysticks and the I/O card supports
  11631.             only one.
  11632.  
  11633.  
  11634.  
  11635.  
  11636.  
  11637.  
  11638.  
  11639.  
  11640.  
  11641.  
  11642.  
  11643.  
  11644.  
  11645.  
  11646.  
  11647.  
  11648.  
  11649.  
  11650.  
  11651.  
  11652.  
  11653.  
  11654.  
  11655.  
  11656.  
  11657.  
  11658.  
  11659.  
  11660.  
  11661.  
  11662.  
  11663.  
  11664.  
  11665.  
  11666.  
  11667.  
  11668.  
  11669.  
  11670.  
  11671.  
  11672.  
  11673.  
  11674.  
  11675.  
  11676.  
  11677.                                                                         187
  11678.  
  11679.  
  11680.  
  11681.  
  11682.  
  11683.           SCHEMATIC WIRING DIAGRAM FOR A JOYSTICK Y-CABLE
  11684.                                               ___
  11685.                          DB15 male         __/   |
  11686.                        connector to       /    o | 1 --------+
  11687.                        Joystick Port   9 | o     |           |
  11688.                         on computer      |     o | 2 --------|-+
  11689.                             +-------- 10 | o     |           | |
  11690.                             |            |     o | 3 --------|-|-+
  11691.                             | +------ 11 | o     |           | | |
  11692.                             | |          |     o | 4 --------|-|-|-+
  11693.                             | |       12 | o     |           | | | |
  11694.                             | |          |     o | 5         | | | |
  11695.                             | | +---- 13 | o     |           | | | |
  11696.                             | | |        |     o | 6 --------|-|-|-|-+
  11697.                             | | | +-- 14 | o     |           | | | | |
  11698.                             | | | |      |     o | 7 --------|-|-|-|-|-+
  11699.                             | | | |   15 | o     |           | | | | | |
  11700.                             | | | |       \__  o | 8         | | | | | |
  11701.                             | | | |          \___|           | | | | | |
  11702.                             | | | |                          | | | | | |
  11703.                             | | | |                          | | | | | |
  11704.                             | | | |  +-----------------------+ | | | | |
  11705.                             | | | |  |                       | | | | | |
  11706.                             | | | |  | +---------------------|-|-|-+ | |
  11707.                             | | | |  | |                     | | | | | |
  11708.                             | | | |  | |                     | | | | | |
  11709.            DB15 female      | | | |  | |     DB15 female     | | | | | |
  11710.            connector to     | | | |  | |     connector to    | | | | | |
  11711.             Joystick B      | | | |  | |      Joystick A     | | | | | |
  11712.                   ___       | | | |  | |            ___      | | | | | |
  11713.                __/   |      | | | |  | |         __/   |     | | | | | |
  11714.               /    o | 1 ---|-|-|-|--+ |        /    o | 1 --+ | | | | |
  11715.            9 | o     |      | | | |    |     9 | o     |       | | | | |
  11716.              |     o | 2 ---+ | | |    |       |     o | 2 ----+ | | | |
  11717.           10 | o     |        | | |    |    10 | o     |         | | | |
  11718.              |     o | 3 -----+ | |    |       |     o | 3 ------+ | | |
  11719.           11 | o     |          | |    |    11 | o     |           | | |
  11720.              |     o | 4 -------|-|----+       |     o | 4 --------+ | |
  11721.           12 | o     |          | |         12 | o     |             | |
  11722.              |     o | 5        | |            |     o | 5           | |
  11723.           13 | o     |          | |         13 | o     |             | |
  11724.              |     o | 6 -------+ |            |     o | 6 ----------+ |
  11725.           14 | o     |            |         14 | o     |               |
  11726.              |     o | 7 ---------+            |     o | 7 ------------+
  11727.           15 | o     |                      15 | o     |
  11728.               \__  o | 8                        \__  o | 8
  11729.                  \___|                             \___|
  11730.  
  11731.           Notes:
  11732.  
  11733.           1)This diagram comes with NO warranties expressed or implied.
  11734.             It is provided for information only.  In no event shall
  11735.             Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  11736.  
  11737.  
  11738.  
  11739.                                                                         188
  11740.  
  11741.  
  11742.  
  11743.  
  11744.  
  11745.             liable for damages resulting from use, misuse, or inability to
  11746.             use this information.
  11747.  
  11748.           2)This cable has worked with a standard joystick port connector,
  11749.             a Sound Blaster port connector, and a Sound Blaster Pro
  11750.             joystick port connector.
  11751.  
  11752.  
  11753.  
  11754.  
  11755.  
  11756.  
  11757.  
  11758.  
  11759.  
  11760.  
  11761.  
  11762.  
  11763.  
  11764.  
  11765.  
  11766.  
  11767.  
  11768.  
  11769.  
  11770.  
  11771.  
  11772.  
  11773.  
  11774.  
  11775.  
  11776.  
  11777.  
  11778.  
  11779.  
  11780.  
  11781.  
  11782.  
  11783.  
  11784.  
  11785.  
  11786.  
  11787.  
  11788.  
  11789.  
  11790.  
  11791.  
  11792.  
  11793.  
  11794.  
  11795.  
  11796.  
  11797.  
  11798.  
  11799.  
  11800.  
  11801.                                                                         189
  11802.